{"id":11721,"date":"2025-08-24T18:43:17","date_gmt":"2025-08-24T18:43:17","guid":{"rendered":"https:\/\/putridparrot.com\/blog\/?p=11721"},"modified":"2025-08-24T18:43:17","modified_gmt":"2025-08-24T18:43:17","slug":"using-valkey-a-redis-compatible-memory-data-store","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/using-valkey-a-redis-compatible-memory-data-store\/","title":{"rendered":"Using Valkey (a Redis compatible memory data store)"},"content":{"rendered":"<p>Valkey is an in-memory, high performance key\/value store. It&#8217;s Redis compatible which means we can use the same protocols, clients etc.<\/p>\n<p>We can run up an instance via docker using<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndocker run --name valkey-cache -d -p 6379:6379 valkey\/valkey\r\n<\/pre>\n<p>The valkey client can be run from the instance using<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndocker exec -ti valkey-cache valkey-cli\r\n<\/pre>\n<p>As mentioned, we can use existing tools that work with Redis, so here&#8217;s a docker-compose.yaml to run up a Valkey instance along with redis-commander<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nservices:\r\n  valkey:\r\n    image: valkey\/valkey\r\n    container_name: valkey\r\n    ports:\r\n      - &quot;6379:6379&quot;\r\n\r\n  redis-commander:\r\n    image: rediscommander\/redis-commander:latest\r\n    container_name: redis-commander\r\n    ports:\r\n      - &quot;8080:8080&quot;\r\n    environment:\r\n      REDIS_HOSTS: valkey:valkey:6379\r\n<\/pre>\n<p>Now we can use localhost:8080 and view\/interact with our data store via a browser.<\/p>\n<p><strong>valkey-cli<\/strong><\/p>\n<p>From the valkey-cli we can run various commands to add a key\/value, get it, delete it etc.<\/p>\n\n<table id=\"tablepress-14\" class=\"tablepress tablepress-id-14\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">Command<\/th><th class=\"column-2\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">KEYS '*'<\/td><td class=\"column-2\">List all keys<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">SET mykey \"Hello\"<\/td><td class=\"column-2\">add\/set a key\/value<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">GET mykey<\/td><td class=\"column-2\">get the value for the given key<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">EXISTS mykey<\/td><td class=\"column-2\">Check if the key exists<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">DEL mykey<\/td><td class=\"column-2\">Delete the key\/value<\/td>\n<\/tr>\n<tr class=\"row-7\">\n\t<td class=\"column-1\">EXPIRE mykey 60<\/td><td class=\"column-2\">Set an expire on the key (60 seconds in this example)<\/td>\n<\/tr>\n<tr class=\"row-8\">\n\t<td class=\"column-1\">TTL mykey<\/td><td class=\"column-2\">Checks the time to live for a key<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-14 from cache -->\n","protected":false},"excerpt":{"rendered":"<p>Valkey is an in-memory, high performance key\/value store. It&#8217;s Redis compatible which means we can use the same protocols, clients etc. We can run up an instance via docker using docker run &#8211;name valkey-cache -d -p 6379:6379 valkey\/valkey The valkey client can be run from the instance using docker exec -ti valkey-cache valkey-cli As mentioned, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[79,142,749],"tags":[],"class_list":["post-11721","post","type-post","status-publish","format-standard","hentry","category-caching","category-redis","category-valkey"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/11721","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=11721"}],"version-history":[{"count":5,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/11721\/revisions"}],"predecessor-version":[{"id":11735,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/11721\/revisions\/11735"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=11721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=11721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=11721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}