blob: 233c3a0da970d97299360e43c6a6c95ad431d8df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#-- vim:sw=2:et
#++
#
# :title: Daybreak registry implementation
#
# Daybreak is a fast in-memory(!!!) database:
# http://propublica.github.io/daybreak/
#
require 'daybreak'
module Irc
class Bot
class Registry
class DaybreakAccessor < AbstractAccessor
def initialize(filename)
super filename + '.db'
end
def registry
super
@registry ||= Daybreak::DB.new(@filename)
end
def flush
return unless @registry
@registry.flush
end
def optimize
return unless @registry
@registry.compact
end
end
end # Registry
end # Bot
end # Irc
|