Class: SandthornSnapshotMemcached::SnapshotStore

Inherits:
Object
  • Object
show all
Defined in:
lib/sandthorn_snapshot_memcached/snapshot_store.rb

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ SnapshotStore

Returns a new instance of SnapshotStore.



5
6
7
8
# File 'lib/sandthorn_snapshot_memcached/snapshot_store.rb', line 5

def initialize url
    options = { :compress => true }
    @store = Dalli::Client.new(url, options)
end

Instance Method Details

#find(aggregate_id) ⇒ Object



14
15
16
# File 'lib/sandthorn_snapshot_memcached/snapshot_store.rb', line 14

def find aggregate_id
  @store.get(aggregate_id)
end

#save(aggregate_id, aggregate) ⇒ Object



10
11
12
# File 'lib/sandthorn_snapshot_memcached/snapshot_store.rb', line 10

def save aggregate_id, aggregate
  @store.set(aggregate_id, aggregate)
end