### Home Classes Methods

### In Files

- lib/termtter/memory_cache.rb

### Parent

DelegateClass(Hash)

### Methods

- ::new
- #adjust
- #flush_all
- #get
- #get_multi
- #set
- #stats
- #try_clone

### Files

- ChangeLog
- README.rdoc

### Class/Module Index

Quicksearch

- Termtter
- Termtter::API
- Termtter::ActiveRubytter
- Termtter::Client
- Termtter::Client::DirectMessage
- Termtter::Client::Jakigan
- Termtter::Client::SearchEvent
- Termtter::Client::UserSearchEvent
- Termtter::Command
- Termtter::CommandCanceled
- Termtter::CommandLine
- Termtter::CommandNotFound
- Termtter::Config
- Termtter::ConfigSetup
- Termtter::Crypt
- Termtter::English
- Termtter::Event
- Termtter::HTTPpool
- Termtter::Hook
- Termtter::HookCanceled
- Termtter::Hookable
- Termtter::JSONError
- Termtter::MemoryCache
- Termtter::MemoryCache::MemCacheMock
- Termtter::OptParser
- Termtter::Plugin
- Termtter::Plugin::Screen
- Termtter::Plugins
- Termtter::Plugins::Haml
- Termtter::Plugins::ListSwitch
- Termtter::RubytterProxy
- Termtter::RubytterProxy::FrequentAccessError
- Termtter::RubytterProxy::LimitManager
- Termtter::Status
- Termtter::StdOut
- Termtter::Storage
- Termtter::Storage::SQLite3
- Termtter::Storage::Status
- Termtter::Task
- Termtter::TaskManager
- Termtter::TypableIdGenerator
- Termtter::UserStreamReceiver
- Yharian
- Yharian::Alex
- Yharian::Jenifer
- Yharian::Remark
- Yharian::Speaker
- Yharian::Vicki
- Yharian::Yhara
- HatenaKeywordHaiku
- HatenaKeywordHaiku::Word
- OAuth
- OAuth::AccessToken
- Readline
- Readline::LIBREADLINE
- AAMaker
- Array
- BrowserNotFound
- Growl
- IRB
- Object
- Status
- String
- Symbol
- TermColor
- TermtterIrcGateway
- User

No matching classes.

# Termtter::MemoryCache::MemCacheMock

### Public Class Methods

new(dummy_server) click to toggle source

    # File lib/termtter/memory_cache.rb, line 34
    def initialize(dummy_server)
      super(Hash.new)
      @keys = []
      @limit = 10000
    end

### Public Instance Methods

flush_all(delay = 0) click to toggle source

    # File lib/termtter/memory_cache.rb, line 62
    def flush_all(delay = 0)
      clear
    end

get(key, raw = false) click to toggle source

    # File lib/termtter/memory_cache.rb, line 46
    def get(key, raw = false)
      try_clone self[key]
    end

get_multi(*keys) click to toggle source

    # File lib/termtter/memory_cache.rb, line 50
    def get_multi(*keys)
      results = {}
      keys.each{ |key|
        results[key] = try_clone self[key]
      }
      results
    end

set(key, value, expiry = 0, raw = false) click to toggle source

    # File lib/termtter/memory_cache.rb, line 40
    def set(key, value, expiry = 0, raw = false)
      self[key] = try_clone value
      adjust(key)
      self
    end

stats() click to toggle source

    # File lib/termtter/memory_cache.rb, line 58
    def stats
      { "total_items"=> length }
    end

### Protected Instance Methods

adjust(key) click to toggle source

    # File lib/termtter/memory_cache.rb, line 72
    def adjust(key)
      return if @keys.include?(key)
      @keys << key
      delete(@keys.shift) while @keys.size > @limit
    end

try_clone(a) click to toggle source

    # File lib/termtter/memory_cache.rb, line 68
    def try_clone(a)
      a.clone rescue a
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.