rolo wrote: > Hi > > I am trying to implement a class which is cacheable. New instances are created if they are not already in cache. > what is the best way? Easy. > redefining new should be a good idea? That, or you can define a define a different class method, which calls new: class Thing @cache = {} def self.instance(name) @cache[name] ||= new(name) end def initialize(name) @name = name end end t1 = Thing.instance "t" t2 = Thing.instance "t" p t1.id p t2.id