memcached
Memcached
Crystal client for Memcached using the text procotol.
Installation
Add this to your application's shard.yml
:
dependencies:
memcached:
github: kuende/memcached
version: ~> 0.2
Usage
require "memcached"
client = Memcached::Client.new("localhost", "11211")
client.set("foo", "bar") # sets key foo=bar
client.set("foo", "bar", ttl: 3) # set key foo=bar, expire after 3 seconds
client.get("foo") # gets key foo
client.get_multi(["foo", "other"]) => {"foo" => "bar", "other" => nil}
client.add("foo", "bar") # set foo=bar only if foo=nil
client.replace("foo", "bar") # set foo=bar only if foo!=nil
client.incr("counter") # increments counter by 1
client.incr("counter", 2) # increments counter by 2
client.decr("counter") # decrements counter by 1
client.decr("counter", 2) # decrements counter by 2
client.append("key", "foo") # appends value foo to key
client.prepend("key", "foo") # prepends value foo to key
client.delete("foo") # deletes key "foo"
client.flush # deletes all keys
Implemented
- get
- get_multi
- set
- add
- replace
- delete
- flush
- append
- prepend
- increment
- decrement
- touch
Contributing
- Fork it ( https://github.com/kuende/memcached/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Repository
memcached
Owner
Statistic
- 2
- 0
- 0
- 0
- 1
- about 8 years ago
- May 3, 2016
License
Other
Links
Synced at
Sun, 17 Nov 2024 18:10:57 GMT
Languages