File: memory.rb

package info (click to toggle)
libinnate-ruby 2010.07-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 812 kB
  • ctags: 621
  • sloc: ruby: 4,242; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 471 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Innate
  class Cache
    # Memory cache is simply a Hash with the Cache::API, it's the reference
    # implementation for every other cache and the default cache.
    class Memory < Hash
      include Cache::API

      def cache_store(*args)
        super{|key, value| self[key] = value }
      end

      def cache_fetch(*args)
        super{|key| self[key] }
      end

      def cache_delete(*args)
        super{|key| delete(key) }
      end
    end
  end
end