Sha256: 25783d2e96185f5ab11e7c0dc4ae82f8ed007fcfcd4b31622e921a96c6827282
Contents?: true
Size: 743 Bytes
Versions: 2
Compression:
Stored size: 743 Bytes
Contents
require 'daybreak' module Docket class Storage attr_accessor :db def initialize filename @db = Daybreak::DB.new filename end def save key, value, options={} touch do db.set! key, value db.compact db.flush end end def append key, value touch do new_value = Array(read(key)) << value save(key, new_value.uniq) end end def remove key touch { db.delete! key } end def read key touch { db.get key } end def load db.load end def close db.close end private def clear! db.clear end def touch &block db.load yield if block_given? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
docket-0.1.2 | lib/docket/storage.rb |
docket-0.1.1 | lib/docket/storage.rb |