Class: FileMapStore

Inherits:
Storage show all
Defined in:
lib/ff/ruby/server/sdk/api/file_map_store.rb

Instance Method Summary collapse

Constructor Details

#initializeFileMapStore

Returns a new instance of FileMapStore.



6
7
8
9
10
# File 'lib/ff/ruby/server/sdk/api/file_map_store.rb', line 6

def initialize

  @keys = Set[]
  @store = Moneta.new(:File, dir: "moneta")
end

Instance Method Details

#closeObject



42
43
44
45
46
47
48
49
# File 'lib/ff/ruby/server/sdk/api/file_map_store.rb', line 42

def close

  if @store != nil

    @store.close
    @keys = Set[]
  end
end

#delete(key) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/ff/ruby/server/sdk/api/file_map_store.rb', line 27

def delete(key)

  check_init

  @store.delete(key)
  keys.delete(key)
end

#get(key) ⇒ Object



20
21
22
23
24
25
# File 'lib/ff/ruby/server/sdk/api/file_map_store.rb', line 20

def get(key)

  check_init

  @store[key]
end

#keysObject



35
36
37
38
39
40
# File 'lib/ff/ruby/server/sdk/api/file_map_store.rb', line 35

def keys

  check_init

  @keys
end

#set(key, value) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/ff/ruby/server/sdk/api/file_map_store.rb', line 12

def set(key, value)

  check_init

  @store[key] = value
  keys.add(key)
end