Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add example to README

  • Loading branch information...
commit 3edbbbda2360bcf0d64768c92f6802b60ede5469 1 parent 8576be2
@tmm1 authored
Showing with 25 additions and 1 deletion.
  1. +25 −1 README
View
26 README
@@ -1 +1,25 @@
-EventedCache is an eventmachine based memcache client. It should be ultrafast and scalable since it leverages the power of ragel to parse memcache protocol and the scalability of eventmachine.
+EventedCache is an eventmachine based memcache client. It should be ultrafast and scalable since it leverages the power of ragel to parse memcache protocol and the scalability of eventmachine.
+
+EM.run{
+
+ # connect to memcached
+ cache = EventedCache.connect('localhost', 11211)
+
+ # set a value that expires in 1 second
+ cache.set('key', 'hello!', 1)
+
+ # read the value
+ cache.get('key'){ |val|
+ # val.data == 'hello!'
+ puts val.data
+ }
+
+ # wait for it to expire and read it again
+ EM.add_timer(2){
+ cache.get('key'){ |val|
+ # val == nil
+ puts val
+ }
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.