Skip to content

Instantly share code, notes, and snippets.

@voxxit
Created July 13, 2010 04:48
Show Gist options
  • Select an option

  • Save voxxit/473465 to your computer and use it in GitHub Desktop.

Select an option

Save voxxit/473465 to your computer and use it in GitHub Desktop.
require 'memcached'
require 'memcache'
# encoding: utf-8
class Currency
CACHE = MemCache.new 'localhost:11211'
class << self
def sterling
find_by_symbol("£")
end
def find_by_symbol(symbol)
CACHE.fetch(symbol) { symbol }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment