Skip to content

Commit

Permalink
add some docs for handlersocket usage
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed May 14, 2011
1 parent 098f76d commit f21b5bf
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,37 @@ Migration

Usage
=====
KeyValue['xxx'] = {:baz=>'foo'})
or KeyValue.set('xxx', {:baz=>'foo'})

# get
KeyValue['xxx'] -> {:baz=>'foo'}
or KeyValue.get('xxx') -> {:baz=>'foo'}

# set
KeyValue['xxx'] = {:baz=>'foo'})
or KeyValue.set('xxx', {:baz=>'foo'})

# delete
KeyValue['xxx'] = nil
or KeyValue.del('xxx')

# increment
KeyValue.inc('xxx') # !! Not atomic
or KeyValue.inc('xxx', 5)

# cache
KeyValue.cache('xxx'){ ..something expensive.. }

HandlerSocket for [750k-qps](http://yoshinorimatsunobu.blogspot.com/2010/10/using-mysql-as-nosql-story-for.html),
[Ubuntu natty guide](http://grosser.it/2011/05/14/installing-mysql-handlersocket-in-ubuntu-natty-for-ruby/)

KeyValue.handler_socket = {:port=>'9998'}

# all read requests use HandlerSocket
KeyValue['xxx'] # -> same as before but faster :)

TODO
====
- HandlerSocket support
- HandlerSocket write support
- use 'key' column as primary key <-> any problems with that ?

Authors
=======
Expand Down

0 comments on commit f21b5bf

Please sign in to comment.