I can get some keys with this command:
keys *_products_*
However, this command returns all the keys where I just need to count them. How can i get it?
You can use DBSIZE or INFO KEYSPACE
But if you want all the keys with a specific pattern in the name you need to use KEYS or SCAN. And you need to pay attention to KEYS, starting it in the production process can affect performance, so you should use it with caution.
KEYS
() KEYS, SCAN counts, . Lua script, .
SCAN
.
KEYS ( SCAN) - , . , , , . Redis Set, - SADD, , patter *products*, .
*products*
, .
DBSIZE
http://redis.io/commands/dbsize
:
redis-cli --scan --pattern '*_products_*' | wc -l
Source: https://habr.com/ru/post/1615127/More articles:Collapsed Regions in Visual Studio - c #How to set up a load balancing environment using ASP.Net 5 (vNext) when using a DNX environment? - asp.net-coreAngular -routing, прямая переадресация URL-адресов - angularjsInstalling an applet (Java card) on J3A081 - javaSwift 2 - Поделитесь видео с помощью UIActivityViewController - facebookBinding to the same port using INADDR_ANY and a specific IP at the same time - socketsVisiting a database in Laravel 5.1 - phpSwift 2 UI Test for hidden element, Trying Hittable - xcodeHow to move an array inside another element of an array as a new property in JavaScript? - javascriptHow to check NS_AVAILABLE_IOS using const CGFloat - iosAll Articles