This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Marcos Alvares (author)
Sun Sep 07 07:31:54 -0700 2008
| name | age | message | |
|---|---|---|---|
| |
LICENSE | ||
| |
README | ||
| |
Rakefile | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
tasks/ | ||
| |
test/ | ||
| |
uninstall.rb |
ActsAsLru ========= This rails plugin transform a ActiveRecord object in a cache pool wich uses the Least Recently Used (LRU) Cache algorithm. It discards the least recently used items first. The usage to this plugins is analysis on the recently portion of a time series in real time applications, without necessity of store a lot of entries. Example ======= belongs_to :asset ##################### [Example] class FakeClass < ActiveRecord::Base acts_as_lru :cache_size => 3, :index_column => [:index_column], :order_column => :updated_at end FakeClass.create(:index_column => 1); FakeClass.count; # => 1 FakeClass.create(:index_column => 1); FakeClass.count; # => 2 FakeClass.create(:index_column => 1); FakeClass.count; # => 3 # First LRU serie with :index_column => 1 FakeClass.create(:index_column => 1); FakeClass.count; # => 3 FakeClass.create(:index_column => 1); FakeClass.count; # => 3 # ... FakeClass.create(:index_column => 2); FakeClass.count; # => 4 FakeClass.create(:index_column => 2); FakeClass.count; # => 5 FakeClass.create(:index_column => 2); FakeClass.count; # => 6 # Second LRU serie with :index_column => 2 FakeClass.create(:index_column => 2); FakeClass.count; # => 6 FakeClass.create(:index_column => 2); FakeClass.count; # => 6 # Each serie has at most three elements # ... ##################### - index_column: is not required. Each column especified must be a valid attribute in the model. - cache_size: is not required and the default value is twenty. - order_column: is not required and the default value is "updated_at". Copyright (c) 2008 Marcos Alvares, released under the MIT license












