Skip to content

Instantly share code, notes, and snippets.

@devarajchidambaram
Last active February 25, 2019 07:06
Show Gist options
  • Save devarajchidambaram/a86d4cf167b22e9bcd2206d4b49803b1 to your computer and use it in GitHub Desktop.
Save devarajchidambaram/a86d4cf167b22e9bcd2206d4b49803b1 to your computer and use it in GitHub Desktop.
Install memcached in windows
Download and install
https://commaster.net/content/installing-memcached-windows
Default port : 11211
To set value
memcached.set('foo', 'bar', 10, function (err) {
})
Note :- 10 is the expiry time is 10 seconds
To get value
memcached.get('foo', function (err) {
})
replace
memcached.replace
Touch
to change the expiry time of the key
memcached.touch Touches the given key.
Note:-
All store operations take an expiration so you need to set it each time you do a store operation.
If you are using the latest version of memcached then you will have the option of doing touch and gat (get and touch) commands. touch will allow you to just reset the expiration of a key and gat will allow you to get a key and reset the expiration. In both cases though you must specify the new expiration time since memcached will not remember it.
To wrap memcached
var proto = Memcached && Memcached.prototype
shimmer.wrap(proto, 'command', function (original) {
return function () {
}
})
.command This is the core functionality of the memcached client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment