Skip to content

Instantly share code, notes, and snippets.

@zdavatz
Created March 15, 2011 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zdavatz/870551 to your computer and use it in GitHub Desktop.
Save zdavatz/870551 to your computer and use it in GitHub Desktop.
persistable.rb
# A Persistable instance can be _prefetchable_. This means that the object
# can be loaded at startup by calling ODBA.cache.prefetch, and that it will
# never expire from the Cache. The prefetch status can be controlled per
# instance by setting the instance variable @odba_prefetch, and per class by
# overriding the module constant ODBA_PREFETCH
def odba_prefetch?
@odba_prefetch \
|| (defined?(self::class::ODBA_PREFETCH) && self::class::ODBA_PREFETCH)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment