Parent

Included Modules

Innate::Cache::DRb

Cache utilizing a DRb server.

You will need to run a corresponding DRb server to use this cache. The example below is using a normal Hash, but it is recommended to use a thread-safe alternative like SyncHash.

@example usage of DRb server

  require 'drb'

  URI = "druby://127.0.0.1:9069"
  CACHE = {}

  $SAFE = 1 # disable eval and friends

  DRb.start_service(URI, CACHE)
  DRb.thread.join

Please note that on some Ruby implementations, access to Hash is not atomic and you might need to lock around access to avoid race conditions.

@example for all caches

  Innate.options.cache.default = Innate::Cache::DRb

@example for sessions only

  Innate.options.cache.session = Innate::Cache::DRb

Constants

OPTIONS

Public Instance Methods

cache_clear() click to toggle source
    # File lib/innate/cache/drb.rb, line 41
41:       def cache_clear
42:         @store.clear
43:       end
cache_delete(*args) click to toggle source
    # File lib/innate/cache/drb.rb, line 53
53:       def cache_delete(*args)
54:         super{|key| @store.delete(key) }
55:       end
cache_fetch(*args) click to toggle source
    # File lib/innate/cache/drb.rb, line 49
49:       def cache_fetch(*args)
50:         super{|key| @store[key] }
51:       end
cache_setup(*args) click to toggle source
    # File lib/innate/cache/drb.rb, line 36
36:       def cache_setup(*args)
37:         address, port = OPTIONS.values_at(:address, :port)
38:         @store = DRbObject.new(nil, "druby://#{address}:#{port}")
39:       end
cache_store(*args) click to toggle source
    # File lib/innate/cache/drb.rb, line 45
45:       def cache_store(*args)
46:         super{|key, value| @store[key] = value }
47:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.