Sha256: e95afefb55ee6de50cf86ae731c8c1d40e7c6e6be72233c90eca50f76a4abfad

Contents?: true

Size: 460 Bytes

Versions: 16

Compression:

Stored size: 460 Bytes

Contents

require 'json'

module Schemas
  module RedisStore

    EXPIRE = 3.days

    def redis_retrieve
      r = Redis.current.get(key)
      r ? JSON.parse(r) : []
    end

    def redis_store!(schema_rows)
      Redis.current.del(key)
      Redis.current.set(key, JSON.generate(schema_rows))

      # should be deleting the key before we store
      # but set expire just in case we switch keys in the code
      Redis.current.expire(key, EXPIRE)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev lib/schemas/redis_store.rb
aleph_analytics-0.4.8 lib/schemas/redis_store.rb
aleph_analytics-0.4.7 lib/schemas/redis_store.rb
aleph_analytics-0.4.4 lib/schemas/redis_store.rb
aleph_analytics-0.4.2 lib/schemas/redis_store.rb
aleph_analytics-0.4.1 lib/schemas/redis_store.rb
aleph_analytics-0.3.0 lib/schemas/redis_store.rb
aleph_analytics-0.2.0 lib/schemas/redis_store.rb
aleph_analytics-0.1.0 lib/schemas/redis_store.rb
aleph_analytics-0.0.6 lib/schemas/redis_store.rb
aleph_analytics-0.0.5 lib/schemas/redis_store.rb
aleph_analytics-0.0.4 lib/schemas/redis_store.rb
aleph_analytics-0.0.3 lib/schemas/redis_store.rb
aleph_analytics-0.0.2 lib/schemas/redis_store.rb
aleph_analytics-0.0.1.alpha lib/schemas/redis_store.rb
aleph_analytics-0.0.0.alpha lib/schemas/redis_store.rb