Sha256: 8b7f75509f5bd5b6a5925f620e4b1c096ff0069058f5fdf8ef924a0994a496bb

Contents?: true

Size: 799 Bytes

Versions: 1

Compression:

Stored size: 799 Bytes

Contents

# frozen_string_literal: true

require "zache"

module CollectionSpace
  class RefCache
    module Backend
      class Zache
        def initialize
          @c = ::Zache.new
        end

        def clean
          @c.remove_by { |key| @c.expired?(key) }
        end

        def connected?
          "PONG" # cute, matches redis response
        end

        def exists?(key)
          @c.exists?(key)
        end

        def flush
          @c.remove_all
        end

        def get(key)
          @c.get(key)
        rescue
          nil
        end

        def put(key, value, lifetime: nil)
          @c.put(key, value, lifetime: lifetime)
        end

        def remove(key)
          @c.remove(key)
        end

        def size
          @c.size
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
collectionspace-refcache-1.0.0 lib/collectionspace/refcache/backend/zache.rb