# redis-memory-analysis **Repository Path**: hhxsv5/redis-memory-analysis ## Basic Information - **Project Name**: redis-memory-analysis - **Description**: Analyzing memory of redis is to find the keys(prefix) which used a lot of memory, export the analysis result into csv file. - **Primary Language**: PHP - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 0 - **Created**: 2018-03-05 - **Last Updated**: 2021-09-15 ## Categories & Tags **Categories**: cache-modules **Tags**: None ## README Redis memory analysis ====== 🔎 Analyzing memory of redis is to find the keys(prefix) which used a lot of memory, export the analysis result into csv file. ## Requirements * PHP 5.4 or later * ext-redis >=2.2.8 * predis/predis ~1.1.0 ## Installation via Composer([packagist](https://packagist.org/packages/hhxsv5/redis-memory-analysis)) ```BASH composer require "hhxsv5/redis-memory-analysis:~1.0" -vvv ``` ## Usage ### Run demo ```PHP include '../vendor/autoload.php'; use Hhxsv5\RMA\AnalyzeRedis; $analyze = new AnalyzeRedis('127.0.0.1', 6379, '123456'); //Scan the keys which can be split by '#' ':' //special pattern characters need to escape by '\' $analyze->start(['#', ':']); //Find the csv file in default target folder: ./reports //CSV file name format: redis-analysis-{host}-{port}-{db}.csv //The keys order by count desc $analyze->saveReport(); ``` ![CSV](https://raw.githubusercontent.com/hhxsv5/redis-memory-analysis/master/examples/demo.png) ## License [MIT](https://github.com/hhxsv5/redis-memory-analysis/blob/master/LICENSE)