{"id":7006,"date":"2022-12-22T07:02:00","date_gmt":"2022-12-22T07:02:00","guid":{"rendered":"https:\/\/www.smarthost.au\/blog\/?p=7006"},"modified":"2024-09-06T07:10:08","modified_gmt":"2024-09-06T07:10:08","slug":"clearing-redis-cache-memory","status":"publish","type":"post","link":"https:\/\/www.smarthost.au\/blog\/clearing-redis-cache-memory","title":{"rendered":"Clearing redis cache memory"},"content":{"rendered":"\n<p>Although redis memory, as a rule, is based on storing the cache so that the website opens much faster, in some situations it may be necessary to clear the redis cache.<\/p>\n\n\n\n<p><strong>It is worth adding here that too frequent clearing of redis memory may result in slower performance of the site because the cache will have to be built from scratch each time.<\/strong><\/p>\n\n\n\n<p>To clear the memory we have three options.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1) Clearing Redis memory from within cPanel<\/h2>\n\n\n\n<p>To begin, we log into cPanel and navigate to the Redis Server application.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"987\" height=\"313\" src=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/Redis_serwer.png\" alt=\"\" class=\"wp-image-7007\" srcset=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/Redis_serwer.png 987w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/Redis_serwer-300x95.png 300w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/Redis_serwer-768x244.png 768w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/Redis_serwer-520x165.png 520w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/Redis_serwer-740x235.png 740w\" sizes=\"auto, (max-width: 987px) 100vw, 987px\" \/><\/figure>\n\n\n\n<p>Then click &#8220;Wyczy\u015b\u0107 Pami\u0119\u0107&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"832\" height=\"439\" src=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/clear_redis.png\" alt=\"\" class=\"wp-image-7008\" srcset=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/clear_redis.png 832w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/clear_redis-300x158.png 300w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/clear_redis-768x405.png 768w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/clear_redis-520x274.png 520w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/clear_redis-740x390.png 740w\" sizes=\"auto, (max-width: 832px) 100vw, 832px\" \/><\/figure>\n\n\n\n<p>Redis memory has been cleared.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2)clearing Redis memory from the terminal\/ssh level<\/h2>\n\n\n\n<p>To use this option to begin with, you need to enable ssh in the customer panel<\/p>\n\n\n\n<p>Go to https:\/\/www.smarthost.au\/panel\/services<\/p>\n\n\n\n<p>While in the panel, click the cogwheel icon on the bar of the hosting service then go to the Settings tab and click \u201cenable ssh\u201d.<\/p>\n\n\n\n<p>In a further step, log in to cPanel and go to from the Terminal application<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"987\" height=\"260\" src=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cpanel_terminal.png\" alt=\"\" class=\"wp-image-7009\" srcset=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cpanel_terminal.png 987w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cpanel_terminal-300x79.png 300w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cpanel_terminal-768x202.png 768w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cpanel_terminal-520x137.png 520w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cpanel_terminal-740x195.png 740w\" sizes=\"auto, (max-width: 987px) 100vw, 987px\" \/><\/figure>\n\n\n\n<p>They will be in the terminal you should type the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/bin\/redis-cli -s \/home\/user_name\/.redis\/redis.sock -a redis_key flushall<\/code><\/pre>\n\n\n\n<p>Accordingly, for ,,user_name,, enter the cpanel username and for ,,redis_key, enter the redis database password available in cpanel -> Redis Server.<\/p>\n\n\n\n<p>After calling the command, the redis memory will be cleared.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3)Cron clearing Redis memory<\/h2>\n\n\n\n<p><strong>This option should be used most judiciously, clearing memory too often will result in almost the same effect as if Redis was disabled.<\/strong><\/p>\n\n\n\n<p>To create a cron we log into cPanel and go to \u201cCron jobs\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"977\" height=\"248\" src=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cron_jobs.png\" alt=\"\" class=\"wp-image-7010\" srcset=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cron_jobs.png 977w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cron_jobs-300x76.png 300w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cron_jobs-768x195.png 768w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cron_jobs-520x132.png 520w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/cron_jobs-740x188.png 740w\" sizes=\"auto, (max-width: 977px) 100vw, 977px\" \/><\/figure>\n\n\n\n<p>To begin with, we set what time the cron task should execute, the most common configurations can be selected from the drop-down bar:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"255\" src=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/jobs_time.png\" alt=\"\" class=\"wp-image-7011\" srcset=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/jobs_time.png 647w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/jobs_time-300x118.png 300w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2024\/09\/jobs_time-520x205.png 520w\" sizes=\"auto, (max-width: 647px) 100vw, 647px\" \/><\/figure>\n\n\n\n<p>After selecting the interval, enter the command in the &#8220;Command&#8221; field:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/bin\/redis-cli -s \/home\/user_name\/.redis\/redis.sock -a redis_key flushall >\/dev\/null 2>&amp;1<\/code><\/pre>\n\n\n\n<p>Accordingly, for ,,user_name,, enter the cpanel username and for ,,redis_key, enter the redis database password available in cpanel -&gt; Redis Server.<\/p>\n\n\n\n<p>After typing the command, click ,,Add new cron job,,<\/p>\n\n\n\n<p>This is how Redis Memory will be cleared at the selected frequency.<\/p>\n\n\n\n<p><strong>It should be emphasized here that cleaning Redis memory during ordinary use is not necessary and even not recommended, although if for some reason there is a need to do so, approaching the clearing of Redis memory should not be done too often, so that in fact this cache has the ability to function properly.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although redis memory, as a rule, is based on storing the cache so that the website opens much faster, in some situations it may be necessary to clear the redis cache. It is worth adding<a class=\"read-more\" href=\"https:\/\/www.smarthost.au\/blog\/clearing-redis-cache-memory\">Continue reading<\/a><\/p>\n","protected":false},"author":4,"featured_media":7012,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[171,535,248,260,170,428,901,259,902,425,172],"tags":[319,1261,1086,289,290,1087,1085],"class_list":["post-7006","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cache","category-cache-pl","category-cache-hr","category-litespeed-hr","category-litespeed","category-litespeed-pl","category-litespeed-uk","category-redis-hr","category-redis-uk","category-redis-pl","category-redis","tag-cache-hr","tag-clearing","tag-cpanel-redis","tag-redis-hr","tag-redis-cache-hr","tag-redis-memory","tag-redis-server-2"],"_links":{"self":[{"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/posts\/7006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/comments?post=7006"}],"version-history":[{"count":1,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/posts\/7006\/revisions"}],"predecessor-version":[{"id":7013,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/posts\/7006\/revisions\/7013"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/media\/7012"}],"wp:attachment":[{"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/media?parent=7006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/categories?post=7006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/tags?post=7006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}