<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>merb-cache/lib/merb-cache/cache.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/core_ext/enumerable.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/core_ext/hash.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/merb_ext/controller.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/stores/fundamental/abstract_store.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/stores/fundamental/file_store.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/stores/fundamental/memcached_store.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/stores/strategy/abstract_strategy_store.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/stores/strategy/action_store.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/stores/strategy/adhoc_store.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/stores/strategy/gzip_store.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/stores/strategy/page_store.rb</filename>
    </added>
    <added>
      <filename>merb-cache/lib/merb-cache/stores/strategy/sha1_store.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/cache_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/core_ext/enumerable_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/core_ext/hash_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/merb_ext/controller_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/stores/fundamental/abstract_store_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/stores/fundamental/file_store_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/stores/fundamental/memcached_store_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/stores/strategy/abstract_strategy_store_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/stores/strategy/action_store_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/stores/strategy/adhoc_store_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/stores/strategy/gzip_store_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/stores/strategy/page_store_spec.rb</filename>
    </added>
    <added>
      <filename>merb-cache/spec/merb-cache/stores/strategy/sha1_store_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,4 @@
-Copyright (c) 2008 Alex Boussinet
+Copyright (c) 2008 Ben Burkert
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file</diff>
      <filename>merb-cache/LICENSE</filename>
    </modified>
    <modified>
      <diff>@@ -1,160 +1,218 @@
-= merb-cache
+merb-cache
+==========
 
-A plugin for the Merb framework that provides caching
+A plugin for the Merb framework that provides caching stores,
+strategies and helpers.
 
-Currently supported methods:
 
-- page caching:
-- action caching
-- fragment caching
-- object caching
 
-Implemented cache stores:
+Tutorial
+==========
 
-- memory
-- memcache
-- file
-- database (sequel, datamapper, activerecord)
+Stores usually set up in application init file
+(init.rb) or environment specific init file (so you can
+use different stores for production, staging and development
+environment if you need to).
 
-== Quick intro
-  With fragment caching, you can mix dynamic and static content.
+# create a fundamental memcache store named :memcached for localhost
+Merb::Cache.setup(:memcached, Merb::Cache::MemcachedStore, {
+  :namespace =&gt; &quot;my_app&quot;,
+  :servers =&gt; [&quot;127.0.0.1:11211&quot;]
+}
 
-  With action caching, the whole template is cached
-  but the before filters are still processed.
-
-  With page caching, the whole template is put in html files in a special
-  directory in order to be handled directly without triggering Merb.
-
-== Quick API
-
-=== Merb::Controller class methods
-  cache_action(action, expiration)
-  cache_actions(action, [action, expiration], ...)
-  cache_page(action, expiration)
-  cache_pages(action, [action, expiration], ...)
-
-=== Merb::Controller instance methods
-  expire_page(key)
-  cached_page?(key)
-  expire_all_pages()
-
-  expire_action(key)
-  cached_action?(key)
-
-  cached?(key)
-  cache_get(key)
-  cache_set(key, data, expiration)
-  expire(key)
-  expire_all()
-
-=== Inside your template
-  cache(key, expiration) do ... end
-
-  # expiration is given in minutes
-
-  # key can be a string or a hash
-  # possible keys when it's a hash:
-  # :key (full key)
-  # :params (array of params to be added to the key)
-  # :action, :controller
-  # :match (true or partial key)
-
-  # Don't forget to look at the specs !!
-
-== Specs
-  $ rake specs:&lt;cache_store&gt;
-  example:
-  $ rake specs:memory
-  $ rake specs:file
-  or just:
-  $ cd spec
-  $ STORE=&lt;cache_store&gt; spec merb-cache_spec.rb
-  # cache_store can be:
-  #   memory, memcache, file, sequel, datamapper, activerecord
-
-== Sample configuration
-
-  Merb::Plugins.config[:merb_cache] = {
-    :cache_html_directory =&gt; Merb.dir_for(:public) / &quot;cache&quot;,
-
-    #:store =&gt; &quot;database&quot;,
-    #:table_name =&gt; &quot;merb_cache&quot;,
-
-    #:disable =&gt; &quot;development&quot;, # disable merb-cache in development
-    #:disable =&gt; true, # disable merb-cache in all environments
-
-    :store =&gt; &quot;file&quot;,
-    :cache_directory =&gt; Merb.root_path(&quot;tmp/cache&quot;),
-
-    #:store =&gt; &quot;memcache&quot;,
-    #:host =&gt; &quot;127.0.0.1:11211&quot;,
-    #:namespace =&gt; &quot;merb_cache&quot;,
-    #:no_tracking =&gt; false,
-
-    #:store =&gt; &quot;memory&quot;,
-    # store could be: file, memcache, memory, database, dummy, ...
-  }
-
-
-== Quick Example
-
-==== controller part
-  class Users &lt; Merb::Controller
-    cache_page :action_name
-    # this will cache the action in public/cache/something.html
-    # this cache entry will never expire (no expiration provided)
-    # for permanent caching you could set your lighty/nginx so as to handle
-    # the .html file directly
-    # for multiple page caching:
-    # cache_pages :action_name, [:another_action, 5], :some_action
-
-    cache_action :another_action, 10
-    # this will cache the action using the cache store
-    # this cache entry will expire in 10 minutes
-    # for multiple action caching:
-    # cache_actions :action_name, [:another_action, 5], :some_action
-
-    def list
-      unless @users = cache_get(&quot;active_users&quot;)
-        @users = User.all(:active =&gt; true)
-        cache_set(&quot;active_users&quot;, @users)
-        # object caching can be used to avoid pulling huge amounts of data
-        # from the database.
-        # you could have calle cache_set with an expiration time as well:
-        # cache_set(&quot;active_users&quot;, @users, 10)
-      end
-      render
-    end
+# a default FileStore
+Merb::Cache.setup(Merb::Cache::FileStore)
 
-    def some_action_that_invalidates_cache
-      expire_page(:action_name)
-      expire_action(:another_action)
-      render
-    end
+# another FileStore
+Merb::Cache.setup(:tmp_cache, Merb::Cache::FileStore, :dir =&gt; &quot;/tmp&quot;)
 
-    def delete
-      expire(&quot;active_users&quot;)
-      render
-    end
 
-    def archives
-      @archives = User.archives unless cached?(&quot;users_archives&quot;)
-      render
+Now lets see how we can use stores in the application:
+
+class Tag
+  def find(parameters = {})
+    # poor man's identity map
+
+    if Merb::Cache[:memcached].exists?(&quot;tags&quot;, parameters)
+      Merb::Cache[:memcached].read(&quot;tags&quot;, parameters)
+    else
+      results = super(parameters)
+      Merb::Cache[:memcached].write(&quot;tags&quot;, results, parameters)
+
+      results
     end
+  end
+
+  def popularity_rating
+    # lets keep the popularity rating cached for 30 seconds
+    # merb-cache will create a key from the model's id &amp; the interval parameter
 
-    def index
-      render
+    Merb::Cache[:memcached].fetch(self.id, :interval =&gt; Time.now.to_i / 30) do
+      self.run_long_popularity_rating_query
     end
   end
+end
+
+
+Or, if you want to use memcache&#8217;s built in expire option:
+
+# expire a cache entry for &quot;bar&quot; (identified by the key &quot;foo&quot; and
+# parameters {:baz =&gt; :bay}) in two hours
+Merb::Cache[:memcached].write(&quot;foo&quot;, &quot;bar&quot;, {:baz =&gt; :bay}, :expire_in =&gt; 2.hours)
+
+# this will fail, because FileStore cannot expire cache entries
+Merb::Cache[:default].write(&quot;foo&quot;, &quot;bar&quot;, {:baz =&gt; :bay}, :expire_in =&gt; 2.hours)
+
+# writing to the FileStore will fail, but the MemcachedStore will succeed
+Merb::Cache[:default, :memcached].write(&quot;foo&quot;, &quot;bar&quot;, {:baz =&gt; :bay}, :expire_in =&gt; 2.hours)
+
+# this will fail
+Merb::Cache[:default, :memcached].write_all(&quot;foo&quot;, &quot;bar&quot;, {:baz =&gt; :bay}, :expire_in =&gt; 2.hours)
+
+
+Setting up strategy stores is very similar to fundamental stores:
+
+# wraps the :memcached store we setup earlier
+Merb::Cache.setup(:zipped, Merb::Cache::GzipStore[:memcached])
+
+# wrap a strategy store
+Merb::Cache.setup(:sha_and_zip, Merb::Cache::SHA1Store[:zipped])
+
+# you can even use unnamed fundamental stores
+Merb::Cache.setup(:zipped_images, Merb::Cache::GzipStore[Merb::Cache::FileStore],
+                  :dir =&gt; Merb.root / &quot;public&quot; / &quot;images&quot;)
+
+# or a combination or strategy &amp; fundamental stores
+module Merb::Cache #makes things a bit shorter
+
+  setup(:secured, SHA1Store[GzipStore[FileStore], FileStore],
+        :dir =&gt; Merb.root / &quot;private&quot;)
+end
+
+
+You can use these strategy stores exactly like fundamental stores in your app code.
+
+Action &amp; Page Caching
+Action &amp; page caching have been implemented in strategy stores. So instead of manually specifying which type of caching you want for each action, you simply ask merb-cache to cache your action, and it will use the fastest cache available.
+
+First, let&#8217;s setup our page &amp; action stores:
+
+config/environments/development.rb
+ 
+  # the order that stores are setup is important 
+  # faster stores should be setup first 
+ 
+  # page cache to the public dir 
+  Merb::Cache.setup(:page_store, Merb::Cache::PageStore[FileStore], 
+                    :dir =&gt; Merb.root / &quot;public&quot;) 
+ 
+  # action cache to memcache 
+  Merb::Cache.setup(:action_store, Merb::Cache::ActionStore[:sha_and_zip]) 
+ 
+  # sets up the ordering of stores when attempting to read/write cache entries 
+  Merb::Cache.setup(:default, Merb::Cache::AdhocStore[:page_store, :action_store]) 
+
+
+And now in our controller:
+class Tags &lt; Merb::Controller 
+
+  # index &amp; show will be page cached to the public dir. The index 
+  # action has no parameters, and the show parameter's are part of 
+  # the URL, making them both page-cache'able 
+  cache :index, :show 
+
+  def index 
+    render 
+  end 
+
+  def show(:slug) 
+    display Tag.first(:slug =&gt; slug) 
+  end 
+end 
+
+Our controller now page caches but the index &amp; show action. Furthermore,
+the show action is cached separately for each slug parameter automatically.
+
+ 
+class Tags &lt; Merb::Controller 
+
+  # the term is a route param, while the page &amp; per_page params are part of the query string. 
+  # If only the term param is supplied, the request can be page cached, but if the page and/or 
+  # per_page param is part of the query string, the request will action cache. 
+  cache :catalog 
+
+  def catalog(term = 'a', page = 1, per_page = 20) 
+    @tags = Tag.for_term(term).paginate(page, per_page) 
+
+    display @tags 
+  end 
+end 
+
+Because the specific type of caching is not specified, the same action can either
+be page cached or action cached depending on the context of the request.
+
 
+Keeping a &#8220;Hot&#8221; Cache
+=====================
 
-====views/users/index.html.erb
-  # this entry will expire in 10 minutes
-  &lt;%- cache &quot;users_index&quot;, 10 do %&gt;
-   &lt;div&gt;some big template&lt;/div&gt;
-  &lt;% end -%&gt;
+Cache expiration is a constant problem for developers. When should content
+be expired? Should we &#8220;sweep&#8221; stale content? How do we balance serving fresh
+content and maintaining fast response times? These are difficult questions
+for developers, and are usually answered with ugly code added across our
+models, views, and controllers. Instead of designing an elaborate
+caching and expiring system, an alternate approach is to keep a &#8220;hot&#8221; cache.
 
-====views/users/archive.html.erb
-  &lt;%- cache &quot;users_archives&quot; do %&gt;
-   &lt;div&gt;some big template&lt;/div&gt;
-  &lt;% end -%&gt;
+So what is a &#8220;hot&#8221; cache? A hot cache is what you get when you ignore
+trying to manually expire content, and instead focus on replacing old
+content with fresh data as soon as it becomes stale. Keeping a hot
+cache means no difficult expiration logic spread out across your
+app, and will all but eliminate cache misses.
+
+The problem until now with this approach has been the impact on
+response times. If the request has to wait on any pages that
+it has made stale to render the fresh version, it can slow down
+the response time dramatically. Thankfully, Merb has the run_later
+method which allows the fresh content to render after the
+response has been sent to the browser.
+It&#8217;s the best of both worlds. Here&#8217;s an example.
+
+ 
+class Tags &amp;lt; Merb::Controller 
+
+  cache :index 
+  eager_cache :create, :index 
+
+  def index 
+    display Tag.all 
+  end 
+
+  def create(slug) 
+    @tag = Tag.new(slug) 
+
+    # redirect them back to the index action 
+    redirect url(:tags) 
+  end 
+end 
+
+The controller will eager_cache the index action whenever the create action
+is successfully called. If the client were to post a new tag to the
+create action, they would be redirect back to the index action.
+Right after the response had been sent to the client, the index action
+would be rendered with the newly created tag included and replaced
+in the cache. So when the user requests for the index action gets
+to the server, the freshest version is already in the cache, and
+the cache miss is avoided. This works regardless of the way
+the index action is cached.
+
+Hot cache helps fight dog pile effect
+(http://highscalability.com/strategy-break-memcache-dog-pile) but
+should be used with caution. It's great when you want to eagerly cache
+some page that user is not going to see immediately after
+creating/updating something because hot cache in current implementation
+uses worker queue (knows as run_later) and it does not guarantee that
+before redirect hits the action data is gonna be already cached.
+
+A good use case of eager caching is front end page of
+some newspaper site when staff updates site content, and
+is not redirected to page that uses new cache values immediately,
+but other users access it frequently.
\ No newline at end of file</diff>
      <filename>merb-cache/README</filename>
    </modified>
    <modified>
      <diff>@@ -12,8 +12,8 @@ PROJECT_URL         = &quot;http://merbivore.com&quot;
 PROJECT_SUMMARY     = &quot;Merb plugin that provides caching (page, action, fragment, object)&quot;
 PROJECT_DESCRIPTION = PROJECT_SUMMARY
 
-GEM_AUTHOR = &quot;Alex Boussinet&quot;
-GEM_EMAIL  = &quot;alex.boussinet@gmail.com&quot;
+GEM_AUTHOR = &quot;Ben Burkert&quot;
+GEM_EMAIL  = &quot;ben@benburkert.com&quot;
 
 GEM_NAME    = &quot;merb-cache&quot;
 PKG_BUILD   = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
@@ -45,27 +45,50 @@ Rake::GemPackageTask.new(spec) do |pkg|
 end
 
 desc &quot;Install the gem&quot;
-task :install do
-  Merb::RakeHelper.install(GEM_NAME, :version =&gt; GEM_VERSION)
+task :install =&gt; [:package] do
+  sh install_command(GEM_NAME, GEM_VERSION)
 end
 
-desc &quot;Uninstall the gem&quot;
-task :uninstall do
-  Merb::RakeHelper.uninstall(GEM_NAME, :version =&gt; GEM_VERSION)
-end
+namespace :jruby do
 
-desc &quot;Create a gemspec file&quot;
-task :gemspec do
-  File.open(&quot;#{GEM_NAME}.gemspec&quot;, &quot;w&quot;) do |file|
-    file.puts spec.to_ruby
+  desc &quot;Run :package and install the resulting .gem with jruby&quot;
+  task :install =&gt; :package do
+    sh jinstall_command(GEM_NAME, GEM_VERSION)
   end
+
+end
+
+desc &quot;Run all specs&quot;
+Spec::Rake::SpecTask.new(&quot;spec&quot;) do |t|
+  t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;, &quot;--colour&quot;]
+  t.spec_files = Dir[&quot;spec/**/*_spec.rb&quot;].sort
 end
 
-desc &quot;Run all examples&quot;
-Spec::Rake::SpecTask.new('spec') do |t|
-  t.spec_opts  = [&quot;-cfs&quot;]
-  t.spec_files = FileList['spec/**/*_spec.rb']
+##############################################################################
+# memcached
+##############################################################################
+MEMCACHED_PORTS = 43042..43043
+
+namespace :memcached do
+  desc &quot;Start the memcached instances for specs&quot;
+  task :start do
+    log = &quot;/tmp/memcached.log&quot;
+    system &quot;&gt;#{log}&quot;
+
+    verbosity = (ENV['DEBUG'] ? &quot;-vv&quot; : &quot;&quot;)
+
+    (MEMCACHED_PORTS).each do |port|
+      system &quot;memcached #{verbosity} -p #{port} &gt;&gt; #{log} 2&gt;&amp;1 &amp;&quot;
+    end
+  end
+
+  desc &quot;Kill the memcached instances&quot;
+  task :kill do
+    `ps awx`.split(&quot;\n&quot;).grep(/#{MEMCACHED_PORTS.to_a.join('|')}/).map do |process| 
+      system(&quot;kill -9 #{process.to_i}&quot;) rescue nil
+    end
+  end
 end
 
 desc 'Default: run spec examples'
-task :default =&gt; 'spec'
+task :default =&gt; 'spec'
\ No newline at end of file</diff>
      <filename>merb-cache/Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +0,0 @@
-capture_#{engine} and concat_#{engine} are required for cache()
-implement other cache store ?</diff>
      <filename>merb-cache/TODO</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,11 @@
+# make sure we're running inside Merb
 if defined?(Merb::Plugins)
-  Merb::Plugins.add_rakefiles &quot;merb-cache/merbtasks&quot;
-  unless 1.respond_to? :minutes
-    class Numeric
-      def minutes; self * 60; end
-      def from_now(now = Time.now); now + self; end
-    end
+  require &quot;merb-cache&quot; / &quot;cache&quot;
+  require &quot;merb-cache&quot; / &quot;core_ext&quot; / &quot;enumerable&quot;
+  require &quot;merb-cache&quot; / &quot;core_ext&quot; / &quot;hash&quot;
+  require &quot;merb-cache&quot; / &quot;merb_ext&quot; / &quot;controller&quot;
+
+  class Merb::Controller
+    include Merb::Cache::CacheMixin
   end
-  require &quot;merb-cache/merb-cache&quot;
 end</diff>
      <filename>merb-cache/lib/merb-cache.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,94 +1,82 @@
 $TESTING=true
-$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
-require &quot;rubygems&quot;
-require &quot;merb-core&quot;
+$:.push File.join(File.dirname(__FILE__), '..', 'lib')
 
-require &quot;merb-cache&quot;
-require File.dirname(__FILE__) / &quot;controller&quot;
+# Deps
+require 'rubygems'
+require 'merb-core'
+require 'merb-action-args'
+require File.join(File.dirname(__FILE__), '..', 'lib', 'merb-cache')
 
-require &quot;merb-haml&quot;
+# We want logging!
+Merb.logger = Merb::Logger.new(File.join(File.dirname(__FILE__), '..', 'log', 'merb_test.log'))
 
-def set_database_adapter(adapter)
-  config_file = File.dirname(__FILE__) / &quot;config/database.yml&quot;
-  config = IO.read(config_file)
-  config.gsub!(/:adapter:\s+.*$/, &quot;:adapter: #{adapter}&quot;)
-  File.open(config_file, &quot;w+&quot;) do |c| c.write(config) end
+Merb.start :environment =&gt; &quot;test&quot;, :adapter =&gt; &quot;runner&quot;
+
+require &quot;merb-core/test&quot;
+Spec::Runner.configure do |config|
+  config.include Merb::Test::Helpers
+  #config.include Merb::Test::ControllerHelper
+  config.include Merb::Test::RouteHelper
 end
 
-def use_cache_store(store, orm = nil)
-  Merb::Plugins.config[:merb_cache] = {
-    :store =&gt; store,
-    :cache_directory =&gt; File.dirname(__FILE__) / &quot;tmp/cache&quot;,
-    :cache_html_directory =&gt; File.dirname(__FILE__) / &quot;tmp/html&quot;,
-    :no_tracking =&gt; false
-  }
-  FileUtils.rm_rf(Dir.glob(File.dirname(__FILE__) / &quot;/tmp&quot;))
-  case store
-  when &quot;dummy&quot;
-  when &quot;file&quot;
-  when &quot;memory&quot;
-  when &quot;memcache&quot;
-    require &quot;memcache&quot;
-  when &quot;database&quot;
-    case orm
-    when &quot;datamapper&quot;
-      Merb.environment = &quot;test&quot;
-      Merb.logger = Merb::Logger.new(&quot;log/merb_test.log&quot;)
-      set_database_adapter(&quot;sqlite3&quot;)
-      require &quot;merb_datamapper&quot;
-    when &quot;activerecord&quot;
-      Merb.logger = Merb::Logger.new(&quot;log/merb_test.log&quot;)
-      set_database_adapter(&quot;sqlite3&quot;)
-      require &quot;merb_activerecord&quot;
-    when &quot;sequel&quot;
-      set_database_adapter(&quot;sqlite&quot;)
-      require &quot;merb_sequel&quot;
-    else
-      raise &quot;Unknown orm: #{orm}&quot;
+class DummyStore &lt; Merb::Cache::AbstractStore
+  cattr_accessor :vault
+  attr_accessor  :options
+  
+  def initialize(config = {})
+    super(config)
+    @options = config
+    @@vault = {}
+  end
+
+  def writable?(*args)
+    true
+  end
+
+  def read(key, parameters = {})
+        
+    if @@vault.keys.include?(key)
+      @@vault[key].find {|data, timestamp, conditions, params| params == parameters}
     end
-  else
-    raise &quot;Unknown cache store: #{store}&quot;
   end
-end
 
-store = &quot;file&quot;
-case ENV[&quot;STORE&quot;] || store
-when &quot;file&quot;
-  use_cache_store &quot;file&quot;
-when &quot;memory&quot;
-  use_cache_store &quot;memory&quot;
-when &quot;memcache&quot;
-  use_cache_store &quot;memcache&quot;
-when &quot;datamapper&quot;
-  use_cache_store &quot;database&quot;, &quot;datamapper&quot;
-when &quot;sequel&quot;
-  use_cache_store &quot;database&quot;, &quot;sequel&quot;
-when &quot;activerecord&quot;
-  use_cache_store &quot;database&quot;, &quot;activerecord&quot;
-when &quot;dummy&quot;
-  use_cache_store &quot;dummy&quot;
-else
-  puts &quot;Invalid cache store: #{ENV[&quot;store&quot;]}&quot;
-  exit
-end
+  def data(key, parameters = {})
+    read(key, parameters)[0] if read(key, parameters)
+  end
 
-require &quot;fileutils&quot;
-FileUtils.mkdir_p(Merb::Plugins.config[:merb_cache][:cache_html_directory])
-FileUtils.mkdir_p(Merb::Plugins.config[:merb_cache][:cache_directory])
+  def time(key, parameters = {})
+    read(key, parameters)[1] if read(key, parameters)
+  end
 
-Merb.start :environment =&gt; &quot;test&quot;, :adapter =&gt; &quot;runner&quot;
+  def conditions(key, parameters = {})
+    read(key, parameters)[2] if read(key, parameters)
+  end
 
-require &quot;merb-core/test&quot;
+  def write(key, data = nil, parameters = {}, conditions = {})
+    (@@vault[key] ||= []) &lt;&lt; [data, Time.now, conditions, parameters]
+    true
+  end
 
-CACHE = CacheController.new(Merb::Test::RequestHelper::FakeRequest.new)
-CACHE.expire_all
+  def fetch(key, parameters = {}, conditions = {}, &amp;blk)
+    @@vault[[key, parameters]] ||= blk.call
+  end
 
-Spec::Runner.configure do |config|
-  config.include Merb::Test::RequestHelper
-  config.before(:each) do
-    Merb::Router.prepare do |r|
-      r.default_routes
-      r.match(&quot;/&quot;).to(:controller =&gt; &quot;cache_controller&quot;, :action =&gt;&quot;index&quot;)
-    end
+  def exists?(key, parameters = {})
+    @@vault.has_key? [key, parameters]
+  end
+
+  def delete(key, parameters = {})
+    @@vault.delete([key, parameters]) unless @@vault[[key, parameters]].nil?
+  end
+
+  def delete_all
+    @@vault = {}
   end
 end
+
+#TODO change this to a work queue per class called in an after aspect
+class Merb::Controller
+  def run_later
+    yield
+  end
+end
\ No newline at end of file</diff>
      <filename>merb-cache/spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-action.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-fragment.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-page.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-store/database-activerecord.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-store/database-datamapper.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-store/database-sequel.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-store/database.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-store/dummy.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-store/file.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-store/memcache.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/cache-store/memory.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/merb-cache.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/lib/merb-cache/merbtasks.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/spec/config/database.yml</filename>
    </removed>
    <removed>
      <filename>merb-cache/spec/controller.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/spec/merb-cache-action_spec.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/spec/merb-cache-fragment_spec.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/spec/merb-cache-page_spec.rb</filename>
    </removed>
    <removed>
      <filename>merb-cache/spec/views/cache_controller/action1.html.erb</filename>
    </removed>
    <removed>
      <filename>merb-cache/spec/views/cache_controller/action2.html.haml</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>f117c96be4b6b4903c92744a20a1280540bf7b7f</id>
    </parent>
  </parents>
  <author>
    <name>Michael S. Klishin</name>
    <email>michael@novemberain.com</email>
  </author>
  <url>http://github.com/wycats/merb/commit/a4d4025ce23900aa4366eb6e338a1e890aaa6328</url>
  <id>a4d4025ce23900aa4366eb6e338a1e890aaa6328</id>
  <committed-date>2008-09-28T00:38:10-07:00</committed-date>
  <authored-date>2008-09-28T00:38:10-07:00</authored-date>
  <message>Replace merb-cache with new implmentation.</message>
  <tree>48efa3e2290e4aeb1fc50945b6ef82df421c30ec</tree>
  <committer>
    <name>Michael S. Klishin</name>
    <email>michael@novemberain.com</email>
  </committer>
</commit>
