Class: Innate::Cache::DRb

### Home Classes Methods

### In Files

- lib/innate/cache/drb.rb

### Parent

Object

### Methods

- #cache_clear
- #cache_delete
- #cache_fetch
- #cache_setup
- #cache_store

### Included Modules

- Innate::Cache::API

### Class/Module Index

Quicksearch

- Innate
- Innate::Action
- Innate::Adapter
- Innate::Cache
- Innate::Cache::API
- Innate::Cache::DRb
- Innate::Cache::FileBased
- Innate::Cache::Marshal
- Innate::Cache::Memory
- Innate::Cache::YAML
- Innate::Current
- Innate::Etanni
- Innate::Helper
- Innate::Helper::Aspect
- Innate::Helper::Aspect::SingletonMethods
- Innate::Helper::CGI
- Innate::Helper::Flash
- Innate::Helper::Link
- Innate::Helper::Redirect
- Innate::Helper::Render
- Innate::HelperAccess
- Innate::HelpersHelper
- Innate::LRUHash
- Innate::LogHub
- Innate::Mock
- Innate::Mock::Session
- Innate::Node
- Innate::Optioned
- Innate::Optioned::SingletonMethods
- Innate::Options
- Innate::Request
- Innate::Response
- Innate::Rewrite
- Innate::Route
- Innate::Session
- Innate::Session::Flash
- Innate::SingletonMethods
- Innate::StateAccessor
- Innate::Traited
- Innate::Trinity
- Innate::URLMap
- Innate::View
- Innate::View::ERB
- Innate::View::Etanni
- Innate::View::None
- Logger
- Logger::ColorFormatter
- Object

No matching classes.

# 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
    def cache_clear
      @store.clear
    end

cache_delete(*args) click to toggle source

    # File lib/innate/cache/drb.rb, line 53
    def cache_delete(*args)
      super{|key| @store.delete(key) }
    end

cache_fetch(*args) click to toggle source

    # File lib/innate/cache/drb.rb, line 49
    def cache_fetch(*args)
      super{|key| @store[key] }
    end

cache_setup(*args) click to toggle source

    # File lib/innate/cache/drb.rb, line 36
    def cache_setup(*args)
      address, port = OPTIONS.values_at(:address, :port)
      @store = DRbObject.new(nil, "druby://#{address}:#{port}")
    end

cache_store(*args) click to toggle source

    # File lib/innate/cache/drb.rb, line 45
    def cache_store(*args)
      super{|key, value| @store[key] = value }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.