Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 3a01143558
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (18 sloc) 0.67 kb
require 'rubygems'
require 'pathname'
root_path = Pathname(__FILE__).dirname.join('..').expand_path
lib_path = root_path.join('lib')
$:.unshift(lib_path)
require 'adapter/memcached'
client = Memcached.new('localhost:11211', :namespace => 'adapter_example')
adapter = Adapter[:memcached].new(client)
adapter.clear
adapter.write('foo', 'bar')
puts 'Should be bar: ' + adapter.read('foo').inspect
adapter.delete('foo')
puts 'Should be nil: ' + adapter.read('foo').inspect
adapter.write('foo', 'bar')
adapter.clear
puts 'Should be nil: ' + adapter.read('foo').inspect
puts 'Should be bar: ' + adapter.fetch('foo', 'bar')
puts 'Should be bar: ' + adapter.read('foo')
Jump to Line
Something went wrong with that request. Please try again.