Sha256: 65903773aed57631ae9bc39ce0c90917dbe9aab5f5bf5b08a5ff1a03424793bd

Contents?: true

Size: 702 Bytes

Versions: 9

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module RailsWebCache
  class RedisCacheStore < Base
    def keys_size
      redis.dbsize
    end

    def keys
      redis.keys
    end

    def read(key)
      return unless type(key) == 'string'
      cache.read(key) if key
    end

    def search(query = '')
      redis.scan_each(match: "*#{query.downcase}*").to_a if query
    end

    def entry(key, options = {})
      return unless key
      return unless type(key) == 'string'
      entry = read_entry(key, options)
      return unless entry
      RailsWebCache::Entry.new(entry)
    end

    private

    def redis
      @redis ||= cache.redis
    end

    def type(key)
      redis.type(key)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rails_web_cache-0.7.6 lib/rails_web_cache/redis_cache_store.rb
rails_web_cache-0.7.5 lib/rails_web_cache/redis_cache_store.rb
rails_web_cache-0.7.4 lib/rails_web_cache/redis_cache_store.rb
rails_web_cache-0.7.3 lib/rails_web_cache/redis_cache_store.rb
rails_web_cache-0.7.2 lib/rails_web_cache/redis_cache_store.rb
rails_web_cache-0.7.0 lib/rails_web_cache/redis_cache_store.rb
rails_web_cache-0.6.1 lib/rails_web_cache/redis_cache_store.rb
rails_web_cache-0.6.0 lib/rails_web_cache/redis_cache_store.rb
rails_web_cache-0.5.0 lib/rails_web_cache/redis_cache_store.rb