Merge branch 'develop'

This commit is contained in:
siddontang 2015-03-13 14:01:47 +08:00
commit 9b93ab9811
5 changed files with 10 additions and 8 deletions

View File

@ -14,7 +14,7 @@ LedisDB now supports multiple different databases as backends.
+ Rich data structure: KV, List, Hash, ZSet, Set. + Rich data structure: KV, List, Hash, ZSet, Set.
+ Data storage is not limited by RAM. + Data storage is not limited by RAM.
+ Various backends supported: LevelDB, goleveldb, LMDB, RocksDB, BoltDB, RAM. + Various backends supported: LevelDB, goleveldb, LMDB, RocksDB, BoltDB, RAM.
+ Supports transactions using LMDB or BotlDB. + Supports transactions using LMDB or BoltDB.
+ Supports Lua scripting. + Supports Lua scripting.
+ Supports expiration and TTL. + Supports expiration and TTL.
+ Can be managed via redis-cli. + Can be managed via redis-cli.

View File

@ -215,8 +215,8 @@ func (cfg *Config) adjust() {
cfg.ConnWriteBufferSize = getDefault(4*KB, cfg.ConnWriteBufferSize) cfg.ConnWriteBufferSize = getDefault(4*KB, cfg.ConnWriteBufferSize)
cfg.TTLCheckInterval = getDefault(1, cfg.TTLCheckInterval) cfg.TTLCheckInterval = getDefault(1, cfg.TTLCheckInterval)
cfg.Databases = getDefault(0, cfg.Databases) cfg.Databases = getDefault(0, cfg.Databases)
if cfg.Databases > 256 { if cfg.Databases > 16 {
cfg.Databases = 256 cfg.Databases = 16
} }
} }

View File

@ -11,7 +11,7 @@ data_dir = "/tmp/ledis_server"
# Set the number of databases. You can use `select dbindex` to choose a db. # Set the number of databases. You can use `select dbindex` to choose a db.
# dbindex must be in [0, databases - 1]. # dbindex must be in [0, databases - 1].
# Maximum databases is 256. # Maximum databases is 16 now.
databases = 16 databases = 16
# Log server command, set empty to disable # Log server command, set empty to disable

View File

@ -11,8 +11,8 @@ data_dir = "/tmp/ledis_server"
# Set the number of databases. You can use `select dbindex` to choose a db. # Set the number of databases. You can use `select dbindex` to choose a db.
# dbindex must be in [0, databases - 1]. # dbindex must be in [0, databases - 1].
# Maximum databases is 256. # Maximum databases is 16 now.
databases = 256 databases = 16
# Log server command, set empty to disable # Log server command, set empty to disable
access_log = "" access_log = ""

View File

@ -45,8 +45,8 @@ func Open(cfg *config.Config) (*Ledis, error) {
if cfg.Databases == 0 { if cfg.Databases == 0 {
cfg.Databases = 16 cfg.Databases = 16
} else if cfg.Databases > 256 { } else if cfg.Databases > 16 {
cfg.Databases = 256 cfg.Databases = 16
} }
os.MkdirAll(cfg.DataDir, 0755) os.MkdirAll(cfg.DataDir, 0755)
@ -131,6 +131,8 @@ func (l *Ledis) flushAll() error {
it := l.ldb.NewIterator() it := l.ldb.NewIterator()
defer it.Close() defer it.Close()
it.SeekToFirst()
w := l.ldb.NewWriteBatch() w := l.ldb.NewWriteBatch()
defer w.Rollback() defer w.Rollback()