Sha256: f6274402b2aa4259df73fe675df6c75c26b77e6119ccd6265ebedb33981e234a

Contents?: true

Size: 977 Bytes

Versions: 1

Compression:

Stored size: 977 Bytes

Contents

# frozen_string_literal: true

require 'securerandom'
require 'concurrent/atomic/reentrant_read_write_lock'

# @api public
# @since 0.1.0
class AnyCache
  require_relative 'any_cache/version'
  require_relative 'any_cache/adapters'

  # @since 0.1.0
  extend Forwardable

  class << self
    # @param driver [Object]
    # @return [AnyCache]
    #
    # @api private
    # @since 0.1.0
    def build(driver)
      new(Adapters.build(driver))
    end
  end

  # @since 0.1.0
  def_delegators :adapter,
                 :read,
                 :write,
                 :delete,
                 :increment,
                 :decrement,
                 :expire,
                 :persist,
                 :clear

  # @return [AnyCache::Adapters::Basic]
  #
  # @api private
  # @since 0.1.0
  attr_reader :adapter

  # @param adapter [AnyCache::Adapters::Basic]
  # @return [void]
  #
  # @api private
  # @since 0.1.0
  def initialize(adapter)
    @adapter = adapter
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
any_cache-0.1.0 lib/any_cache.rb