Answers.Body: <p>Not without some brute-force cracking.</p>
  
  <p>The keys you pass into <a href="http://www.yiiframework.com/doc/api/1.1/CFileCache" rel="nofollow">CFileCache's</a> <a href="http://www.yiiframework.com/doc/api/1.1/CCache#set-detail" rel="nofollow">set</a> and <a href="http://www.yiiframework.com/doc/api/1.1/CCache#get-detail" rel="nofollow">get</a> methods are an md5 hash of your key prepended with your Craft installation's <a href="https://craftcms.com/docs/config-settings#appId" rel="nofollow">appId</a> (which by default is a randomly generated string).</p>
  
  <p>So with a key of <code>testKey</code>, that could end up as a value of <code>3f8b3c45a9c6f395d02b930f18910a92</code>.  For CFileCache, that value ends up being the file name of the cache file and gets put in <code>craft/storage/runtime/cache/3f8b3c45a9c6f395d02b930f18910a92.bin</code>.</p>
  
  <p>Later, when you call get and pass in the key of <code>testKey</code>, it goes through the same process and checks to see if a file named <code>3f8b3c45a9c6f395d02b930f18910a92.bin</code> exists.  If it does, it knows there is a match.</p>
  
  <p>As you can see, there's no way to find that match without knowing the key ahead of time (unless you brute-force cracked md5, which is doable, but probably not practical for your use-case).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-15T18:28:40.730Z
Answers.Text: Well yeah, "brute-force crack" is my middle name ;) ... Alright, thanks for the answer Brad. I'll have to rethink ways to go about my plugin.
Answers.UserDisplayName: Chase Giunta
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-15T18:19:16.023Z
Answers.LastActivityDate: 2015-12-15T18:29:48.713Z
Answers.LastEditDate: 2015-12-15T18:29:48.713Z
Answers.UserDisplayName: Brad Bell
Body: <p>Does <code>craft()-&gt;cache-&gt;</code> have a way of returning all the cache records? 
  I need to delete some caches, but only if the key begins with a certain prefix, “<code>ranking__getAthletePoints_</code>”. I won’t know the numbers following in the key names. If I could grab all of them, I assume I could check against the key names with something like <code>startsWith()</code> and delete the correct caches that way.</p>
  
  <p>Very much out of my element with php &amp; plugin development! Thanks for any help!</p>
  
Tags: <plugin-development><cache>
Title: Return all cache records, delete caches with prefixed keys
ThreadText: # Return all cache records, delete caches with prefixed keys
  
  (Asked by: username_0 on 2015-12-15)
  
  Does `craft()->cache->` have a way of returning all the cache records?
  I need to delete some caches, but only if the key begins with a certain prefix, “`ranking__getAthletePoints_`”. I won’t know the numbers following in the key names. If I could grab all of them, I assume I could check against the key names with something like `startsWith()` and delete the correct caches that way.
  
  Very much out of my element with php & plugin development! Thanks for any help!
  
  **Tags:** plugin-development, cache
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-12-15. Score: 1 | Accepted answer
  
  Not without some brute-force cracking.
  
  The keys you pass into [CFileCache's](http://www.yiiframework.com/doc/api/1.1/CFileCache) [set](http://www.yiiframework.com/doc/api/1.1/CCache#set-detail) and [get](http://www.yiiframework.com/doc/api/1.1/CCache#get-detail) methods are an md5 hash of your key prepended with your Craft installation's [appId](https://craftcms.com/docs/config-settings#appId) (which by default is a randomly generated string).
  
  So with a key of `testKey`, that could end up as a value of `3f8b3c45a9c6f395d02b930f18910a92`. For CFileCache, that value ends up being the file name of the cache file and gets put in `craft/storage/runtime/cache/3f8b3c45a9c6f395d02b930f18910a92.bin`.
  
  Later, when you call get and pass in the key of `testKey`, it goes through the same process and checks to see if a file named `3f8b3c45a9c6f395d02b930f18910a92.bin` exists. If it does, it knows there is a match.
  
  As you can see, there's no way to find that match without knowing the key ahead of time (unless you brute-force cracked md5, which is doable, but probably not practical for your use-case).
  
  > **Comments:**
  > **username_0**: Well yeah, "brute-force crack" is my middle name ;) ... Alright, thanks for the answer username_1. I'll have to rethink ways to go about my plugin.  
  
  ---
  
  