def insert(object, modified = true)
      unless object.is_a?(@klass)
        raise ArgumentError, "You can insert only #{@klass} objects in this " +
          "cache. You have tried to insert a #{object.class} instead."
      end

      if modified
        @modified_entries[object.uid] = object
      else
        index = object.uid % @size
        @unmodified_entries[index] = object
      end

      nil
    end
def insert(object, modified = true)
      unless object.is_a?(@klass)
        raise ArgumentError, "You can insert only #{@klass} objects in this " +
          "cache. You have tried to insert a #{object.class} instead."
      end

      if modified
        @modified_entries[object.uid] = object
      else
        index = object.uid % @size
        @unmodified_entries[index] = object
      end

      nil
    end
This cache class manages the presence of objects that primarily live in
 a backing store but temporarily exist in memory as well. To work with
 these objects, direct references must be only very short lived. Indirect
 references can be done via a unique ID that the object must provide. Due
 to the indirect references the Ruby garbage collector can collect these
 objects. To reduce the read and write latencies of the backing store
 this class keeps a subset of the objects in memory which prevents them
 from being collected. All references to the objects must be resolved via
 the get() method to prevent duplicate instances in memory of the same
 in-store object. The cache uses a least-recently-used (LRU) scheme to
 cache objects.
 @param size [Integer] Minimum number of objects to be cached at a time
 @param flush_delay [Integer] Determines how often non-forced flushes are
        ignored in a row before the flush is really done.
 @param klass [Class] The class of the objects to be cached. Objects must
        provide a uid() method that returns a unique ID for every object.
 @param collection [] The object collection the objects belong to. It
        must provide a ::load method.
 Insert an object into the cache.
 @param object [Object] Object to cache
 @param modified [Boolean] True if the object was modified, false otherwise