Sha256: 05f9c28d993805766ec0288434e2d1e1839f6fcae5eb6e8188e1ae2d51972015

Contents?: true

Size: 418 Bytes

Versions: 15

Compression:

Stored size: 418 Bytes

Contents

module Isomorfeus
  class ThreadLocalCache
    def initialize
      Thread.current[:local_cache] = {} unless Thread.current.key?(:local_cache)
    end

    def [](key)
      Thread.current[:local_cache][key]
    end
    alias fetch []

    def []=(key, value)
      Thread.current[:local_cache][key] = value
    end
    alias store []=

    def key?(key)
      Thread.current[:local_cache].key?(key)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
isomorfeus-react-16.13.0 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.24 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.23 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.22 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.21 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.20 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.19 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.18 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.17 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.16 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.15 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.14 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.13 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.12 lib/isomorfeus/thread_local_cache.rb
isomorfeus-react-16.12.11 lib/isomorfeus/thread_local_cache.rb