How to get list of all cached items by key in Laravel 5?

前端 未结 5 848
旧时难觅i
旧时难觅i 2021-02-19 10:01

The Cache class in laravel has methods such as get(\'itemKey\') to retrieve items from the cache, and remember(\'itemKey\', [\'myData1\', \'myData2\']) to save items in the cach

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-19 10:35

    For Memcached, you can do this:

    cache()->getMemcached()->getAllKeys()
    
    1. get Illuminate\Cache\CacheManager
    2. Get Memcached: http://php.net/manual/de/class.memcached.php
    3. getAllKeys(): http://php.net/manual/de/memcached.getallkeys.php

    This gives you an array of keys you can go through.

提交回复
热议问题