Module: Innate::Cache::FileBased

### Home Classes Methods

### In Files

- lib/innate/cache/file_based.rb

### Methods

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

### 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::FileBased

Used by caches that serialize their contents to the filesystem. Right now we do not lock around write access to the file outside of the process, that means that all FileBased caches are not safe for use if you need more than one instance of your application.

### Attributes

filename[R]

### Public Instance Methods

cache_clear() click to toggle source

    # File lib/innate/cache/file_based.rb, line 21
    def cache_clear
      FileUtils.mkdir_p(@dir)
      FileUtils.rm_f(@filename)
      @store = self.class::STORE.new(@filename)
    end

cache_delete(*args) click to toggle source

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

cache_fetch(*args) click to toggle source

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

cache_setup(*args) click to toggle source

    # File lib/innate/cache/file_based.rb, line 11
    def cache_setup(*args)
      @prefix = args.compact.join('-')

      @dir = File.join(Dir.tmpdir, self.class::DIR)
      FileUtils.mkdir_p(@dir)

      @filename = File.join(@dir, @prefix + self.class::EXT)
      @store = self.class::STORE.new(@filename)
    end

cache_store(*args) click to toggle source

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

transaction(&block) click to toggle source

    # File lib/innate/cache/file_based.rb, line 39
    def transaction(&block)
      Innate.sync{ @store.transaction(&block) }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.