Sha256: cdbf99f929cc7280a10b35a7ac1c6e005570abbb1f6af0fe047ed5ff7e69b1bd
Contents?: true
Size: 999 Bytes
Versions: 43
Compression:
Stored size: 999 Bytes
Contents
module Picky module Backends class Redis module DirectlyManipulable attr_accessor :backend, :key def self.make backend, list, key list.extend DirectlyManipulable list.backend = backend list.key = key end # THINK Current implementation is very brittle. # @@append_index = 0 def << value super value backend.client.zadd "#{backend.namespace}:#{key}", (@@append_index+=1), value backend[key] end # THINK Current implementation is very brittle. # @@unshift_index = 0 def unshift value super value backend.client.zadd "#{backend.namespace}:#{key}", (@@unshift_index-=1), value backend[key] end def delete value result = super value backend.client.zrem "#{backend.namespace}:#{key}", value if result result end end end end end
Version data entries
43 entries across 43 versions & 1 rubygems