diff options
Diffstat (limited to 'lib/rbot/registry')
-rw-r--r-- | lib/rbot/registry/daybreak.rb | 5 | ||||
-rw-r--r-- | lib/rbot/registry/dbm.rb | 11 | ||||
-rw-r--r-- | lib/rbot/registry/sqlite.rb | 5 | ||||
-rw-r--r-- | lib/rbot/registry/tc.rb | 5 |
4 files changed, 12 insertions, 14 deletions
diff --git a/lib/rbot/registry/daybreak.rb b/lib/rbot/registry/daybreak.rb index 6058b408..233c3a0d 100644 --- a/lib/rbot/registry/daybreak.rb +++ b/lib/rbot/registry/daybreak.rb @@ -24,6 +24,11 @@ class Registry @registry ||= Daybreak::DB.new(@filename) end + def flush + return unless @registry + @registry.flush + end + def optimize return unless @registry @registry.compact diff --git a/lib/rbot/registry/dbm.rb b/lib/rbot/registry/dbm.rb index a13cb8ce..9c0304a9 100644 --- a/lib/rbot/registry/dbm.rb +++ b/lib/rbot/registry/dbm.rb @@ -23,21 +23,10 @@ class Registry @registry ||= DBM.open(@filename, 0666, DBM::WRCREAT) end - def flush - return if !@registry - # ruby dbm has no flush, so we close/reopen :( - close - registry - end - def dbexists? not Dir.glob(@filename + '.*').empty? end - def optimize - # unsupported! - end - end end # Registry diff --git a/lib/rbot/registry/sqlite.rb b/lib/rbot/registry/sqlite.rb index 89e7d78c..1af5d242 100644 --- a/lib/rbot/registry/sqlite.rb +++ b/lib/rbot/registry/sqlite.rb @@ -29,10 +29,9 @@ class Registry @registry end - def flush - end - def optimize + return unless @registry + @registry.execute('VACUUM') end def [](key) diff --git a/lib/rbot/registry/tc.rb b/lib/rbot/registry/tc.rb index 63bfdf78..4e248f42 100644 --- a/lib/rbot/registry/tc.rb +++ b/lib/rbot/registry/tc.rb @@ -36,6 +36,11 @@ class Registry @registry.sync end + def optimize + return unless @registry + @registry.optimize + end + end end # Registry |