CacheTree

The idea behind this, is to be able to manage very large ammounts of cache files. and expire millions of cache files in just a few microseconds.

Instead of performing some ActiveRecord#touch and have it creating a massive sequence of queries bouncing off going up/down the herarchies to eliminate a group of items from the cache

CacheTree stores cache in trees, actually it borrows the btree strategy to fetch and quickly determine where cache files are.

you can always add new subtrees or create new trees and handle the cache at different levels. no matter where you are cache expiring is superfast.

While the actual deletion of the expired cache files is also fast. it is recomended to do so in some sort of background job solution.

Trees are cool :)

Contributing to cache_tree

require 'rubygems'
require 'cache_tree'

class Record
  def id
    1
  end
end

CacheTree::Node.directory = 'cache_tree'
record = CacheTree::Node.new(Record.new)
CacheTree::Manager.instance.use(record)
unless CacheTree::Manager.instance.exists?
  CacheTree::Manager.instance.save('data')
end
puts CacheTree::Manager.instance.read

Copyright © 2012 kazuyoshi tlacaelel. See LICENSE.txt for further details.