Class Variable accessibility in multiple rails instance


I have a rails application, wich display data from database.
I have a ruby script wich load rails environment and fill the

I would like to do a cache system for the model X, while my ruby
script puts data

model X < ActiveRecord::Base
  @@cached_data = {}

  def after_create
    @@cached_data[] = self

  def get_cache

The probleme is how make @@cached_data visible from my rails
application ?

You don't do this. If you want rails application caching, look into Memcached.