Memcached: Difference between revisions

No edit summary
No edit summary
Line 3: Line 3:
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering. See the [https://github.com/memcached/memcached/wiki/TutorialCachingStory Caching Story] that explains how every web application eventually turns to caching to increase performance.
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering. See the [https://github.com/memcached/memcached/wiki/TutorialCachingStory Caching Story] that explains how every web application eventually turns to caching to increase performance.


See Also:
== Memcached commands ==
Dump all the keys in memcached
<syntaxhighlight lang="bash">
memdump --servers=localhost
</syntaxhighlight>
simpleSAMLphp.session.5c88998d9c84839323e37f563ba75fbd
 
GET a specific key value
<syntaxhighlight lang="bash">
echo 'get simpleSAMLphp.session.5c88998d9c84839323e37f563ba75fbd' | nc 127.0.0.1 11211
</syntaxhighlight>
VALUE simpleSAMLphp.session.5c88998d9c84839323e37f563ba75fbd 0 1879
a:2:{s:9:"timestamp";d:1711046755.552315;s:4:"data";O:18:"SimpleSAML\Session":10:{s:9:"sessionId";s:32:"5c88998d9c84839323e37f563ba75fbd";s:9:"transient";b:0;s:7:"trackid";s:10:"6db0c2e647";s:16:"rememberMeExpire";N;s:5:"dirty";b:0;s:19:"callback_registered";b:0;s:9:"dataStore";a:1:{s:16:"core:errorreport";a:3:{s:8:"509a5645";a:3:{s:7:"expires";i:1711061090;s:7:"timeout";i:14400;s:4:"data";a:7:{s:12:"exceptionMsg";s:174:"SimpleSAML\Error\NotFound: The requested page 'https://localhost/simplesaml/module.php/admin/' could not be found. The module 'admin' was either not found, or wasn't enabled.";s:14:"exceptionTrace";s:0:"";s:8:"reportId";s:8:"509a5645";s:7:"trackId";s:10:"6db0c2e647";s:3:"url";s:46:"https://localhost/simplesaml/module.php/admin/";s:7:"version";s:5:"2.1.1";s:7:"referer";s:7:"unknown";}}s:8:"6f3f88ff";a:3:{s:7:"expires";i:1711061101;s:7:"timeout";i:14400;s:4:"data";a:7:{s:12:"exceptionMsg";s:174:"SimpleSAML\Error\NotFound: The requested page 'https://localhost/simplesaml/module.php/admin/' could not be found. The module 'admin' was either not found, or wasn't enabled.";s:14:"exceptionTrace";s:0:"";s:8:"reportId";s:8:"6f3f88ff";s:7:"trackId";s:10:"6db0c2e647";s:3:"url";s:46:"https://localhost/simplesaml/module.php/admin/";s:7:"version";s:5:"2.1.1";s:7:"referer";s:7:"unknown";}}s:8:"ccb23c67";a:3:{s:7:"expires";i:1711061155;s:7:"timeout";i:14400;s:4:"data";a:7:{s:12:"exceptionMsg";s:174:"SimpleSAML\Error\NotFound: The requested page 'https://localhost/simplesaml/module.php/admin/' could not be found. The module 'admin' was either not found, or wasn't enabled.";s:14:"exceptionTrace";s:0:"";s:8:"reportId";s:8:"ccb23c67";s:7:"trackId";s:10:"6db0c2e647";s:3:"url";s:46:"https://localhost/simplesaml/module.php/admin/";s:7:"version";s:5:"2.1.1";s:7:"referer";s:7:"unknown";}}}}s:12:"associations";a:0:{}s:9:"authToken";N;s:8:"authData";a:0:{}}}
END
 
Empty the memcached (it doesn't actually delete, but it expires everything)
<syntaxhighlight lang="bash">
Echo 'flush_all' | nc 127.0.0.1:11211
</syntaxhighlight>
 
 
==See Also==


*[https://github.com/memcached/memcached/wiki/Commands Memcache Commands]
*[https://github.com/memcached/memcached/wiki/Commands Memcache Commands]