<p>Correct... <code>craft()-&gt;fileCache</code> will save to your <code>craft/storage/runtime/cache</code> folder by default, which will have a .bin file that has a hash of the key you provided when calling <code>set()</code> and the contents will be a serialized version of the value you passed in.</p>

<p>Also worth noting that while <code>craft()-&gt;fileCache</code> still exists, as of Craft 2.0, it is simply a shortcut to <code>craft()-&gt;cache</code>, when the <a href="http://buildwithcraft.com/docs/config-settings#cacheMethod">cacheMethod</a> config setting is set to <code>file</code>.</p>

CC BY-SA 3.0
2014-06-30T18:43:54.253Z
Great, thanks Brad! To clarify further... if I use `fileCache` then I'm determining at the **plugin level** where the data will get saved, but if I just use `cache` it will default to wherever the website's **config file** specifies. Is that correct?
Lindsey D
CC BY-SA 3.0
2014-06-30T20:06:33.227Z
Yup... nailed it.
Brad Bell
CC BY-SA 3.0
2014-06-30T09:11:40.397Z
2014-06-30T09:11:40.397Z
Brad Bell
<p>Just looking for a little clarification on the <code>craft()-&gt;fileCache</code> method...</p>

<p>Everybody already knows that when a cookie is set, that cookie only exists on the end-user's computer. No one else using the website can access that cookie.</p>

<p>But if I were to replace that cookie getter/setter with the <code>craft()-&gt;fileCache</code> getter/setter methods, is that data now available to everyone? Where a cookie is stored on the <strong>client</strong> machine, the <code>fileCache</code> data is stored on the <strong>server</strong>?</p>

<p>This is what I suspect is happening, just trying to be sure that I'm interpreting this correctly.</p>

<plugin-development><filecache><cookies>
How is "craft()->fileCache" different from using cookies?
# How is "craft()->fileCache" different from using cookies?

(Asked by: username_0 on 2014-06-30)

Just looking for a little clarification on the `craft()->fileCache` method...

Everybody already knows that when a cookie is set, that cookie only exists on the end-user's computer. No one else using the website can access that cookie.

But if I were to replace that cookie getter/setter with the `craft()->fileCache` getter/setter methods, is that data now available to everyone? Where a cookie is stored on the **client** machine, the `fileCache` data is stored on the **server**?

This is what I suspect is happening, just trying to be sure that I'm interpreting this correctly.

**Tags:** plugin-development, filecache, cookies

---

## 1 answers

### Answer by username_1 on 2014-06-30. Score: 7 | Accepted answer

Correct... `craft()->fileCache` will save to your `craft/storage/runtime/cache` folder by default, which will have a .bin file that has a hash of the key you provided when calling `set()` and the contents will be a serialized version of the value you passed in.

Also worth noting that while `craft()->fileCache` still exists, as of Craft 2.0, it is simply a shortcut to `craft()->cache`, when the [cacheMethod](http://buildwithcraft.com/docs/config-settings#cacheMethod) config setting is set to `file`.

> **Comments:**
> **username_0**: Great, thanks Brad! To clarify further... if I use `fileCache` then I'm determining at the **plugin level** where the data will get saved, but if I just use `cache` it will default to wherever the website's **config file** specifies. Is that correct?  
> **username_1**: Yup... nailed it.  

---

