File: weak.rb

package info (click to toggle)
ruby-moneta 1.6.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,776 kB
  • sloc: ruby: 13,201; sh: 178; makefile: 7
file content (31 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module Moneta
  # Adds weak create support to the underlying store
  #
  # @note The create method will not be thread or multi-process safe (this is meant by weak)
  # @api public
  class WeakCreate < Proxy
    include CreateSupport

    # @param [Moneta store] adapter The underlying store
    # @param [Hash] options
    def initialize(adapter, options = {})
      raise 'Store already supports feature :create' if adapter.supports?(:create)
      super
    end
  end

  # Adds weak increment support to the underlying store
  #
  # @note The increment method will not be thread or multi-process safe (this is meant by weak)
  # @api public
  class WeakIncrement < Proxy
    include IncrementSupport

    # @param [Moneta store] adapter The underlying store
    # @param [Hash] options
    def initialize(adapter, options = {})
      raise 'Store already supports feature :increment' if adapter.supports?(:increment)
      super
    end
  end
end