-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Improve Redis cache implementation
- Add Redis availability check in tests - Make ResetAllDB pure virtual in CacheBase - Update CMake configuration for Redis support
- Loading branch information
1 parent
476faef
commit 48f2702
Showing
2 changed files
with
33 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,48 @@ | ||
option(OPENMIND_STORAGE_FOUNDATIONDB "Use Apple FoundationDB library for one of the multistorage levels" OFF) | ||
option(OPENMIND_STORAGE_LEVELDB "Use Google LevelDB library for one of the multistorage levels" ON) | ||
option(OPENMIND_STORAGE_REDIS "Use Redis for distributed caching" OFF) | ||
|
||
set(DEPENDENCIES rt) | ||
if(OPENMIND_STORAGE_LEVELDB OR OPENMIND_STORAGE_FOUNDATIONDB) | ||
if(OPENMIND_STORAGE_LEVELDB OR OPENMIND_STORAGE_FOUNDATIONDB OR OPENMIND_STORAGE_REDIS) | ||
option(OPENMIND_STORAGE_ALLOW_UPGRADE "Update optimized cached values during fetch if new optimizations applied" ON) | ||
option(OPENMIND_STORAGE_VOLATILE "Clean cache each start (for debugging purposes)" OFF) | ||
|
||
if(OPENMIND_STORAGE_LEVELDB) | ||
find_package(Threads) # workaround leveldb config bug | ||
list(APPEND DEPENDENCIES google/leveldb) | ||
if(NOT WIN32) | ||
list(APPEND DEPENDENCIES pthread) | ||
endif() | ||
endif() | ||
if(OPENMIND_STORAGE_LEVELDB) | ||
find_package(Threads) # workaround leveldb config bug | ||
list(APPEND DEPENDENCIES google/leveldb) | ||
if(NOT WIN32) | ||
list(APPEND DEPENDENCIES pthread) | ||
endif() | ||
endif() | ||
|
||
if(OPENMIND_STORAGE_FOUNDATIONDB) | ||
list(APPEND DEPENDENCIES ohhmm/FoundationDB) | ||
endif() | ||
if(OPENMIND_STORAGE_FOUNDATIONDB) | ||
list(APPEND DEPENDENCIES ohhmm/FoundationDB) | ||
endif() | ||
|
||
endif(OPENMIND_STORAGE_LEVELDB OR OPENMIND_STORAGE_FOUNDATIONDB) | ||
if(OPENMIND_STORAGE_REDIS) | ||
find_library(HIREDIS_LIBRARY NAMES hiredis) | ||
find_path(HIREDIS_INCLUDE_DIR NAMES hiredis/hiredis.h) | ||
if(HIREDIS_LIBRARY AND HIREDIS_INCLUDE_DIR) | ||
include_directories(${HIREDIS_INCLUDE_DIR}) | ||
list(APPEND DEPENDENCIES ${HIREDIS_LIBRARY}) | ||
else() | ||
message(FATAL_ERROR "hiredis library not found. Please install libhiredis-dev") | ||
endif() | ||
endif() | ||
|
||
endif(OPENMIND_STORAGE_LEVELDB OR OPENMIND_STORAGE_FOUNDATIONDB OR OPENMIND_STORAGE_REDIS) | ||
|
||
lib(${DEPENDENCIES}) | ||
|
||
if(OPENMIND_STORAGE_LEVELDB) | ||
target_compile_definitions(${this_target} PUBLIC OPENMIND_STORAGE_LEVELDB) | ||
target_compile_definitions(${this_target} PUBLIC OPENMIND_STORAGE_LEVELDB) | ||
endif() | ||
if(OPENMIND_STORAGE_FOUNDATIONDB) | ||
target_compile_definitions(${this_target} PUBLIC OPENMIND_STORAGE_FOUNDATIONDB) | ||
target_compile_definitions(${this_target} PUBLIC OPENMIND_STORAGE_FOUNDATIONDB) | ||
endif() | ||
if(OPENMIND_STORAGE_REDIS) | ||
target_compile_definitions(${this_target} PUBLIC OPENMIND_STORAGE_REDIS) | ||
endif() | ||
if(OPENMIND_STORAGE_ALLOW_UPGRADE) | ||
target_compile_definitions(${this_target} PUBLIC ALLOW_UPGRADE OPENMIND_STORAGE_ALLOW_UPGRADE) | ||
endif() | ||
target_compile_definitions(${this_target} PUBLIC ALLOW_UPGRADE OPENMIND_STORAGE_ALLOW_UPGRADE) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters