-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaddStorage.cfm
54 lines (45 loc) · 2.46 KB
/
addStorage.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<h3>How to Add You Own Storage</h3>
<p>Adding your own storage to Cache on Wheels is really easy. All you have to do is follow these simple steps and you will be caching to your datasource in no time!</p>
<ol>
<li>Create a <code>storage</code> directory the root of your cfwheels website</li>
<li>Create a a CFC in the storage directory that implements <code>cache.storage.AbstractStorage</code> and extends <code>BaseStorage</code><br />
<pre><code><cfcomponent implements="AbstractStorage" extends="BaseStorage">
<cffunction name="init" >
</cffunction>
</cfcomponent></code></pre>
</li>
<li>
The Abstract interface will implement the following functions. You must implement them exactly how they are:
<p>NOTE: The <code>default</code> argument in the <code>ARGUMENTS</code> struct is dynamic for each function and is the only variable that can be different than the interface declaration</p>
<pre><code><cffunction name="add" access="public" returntype="void" >
<cfargument name="key" required="true" type="string" />
<cfargument name="value" required="true" type="any" />
<cfargument name="time" type="numeric" required="false" />
<cfargument name="category" type="string" required="false" />
<cfargument name="currentTime" type="date" required="false" />
</cffunction>
<cffunction name="get" access="public" returntype="any">
<cfargument name="key" required="true" type="string" />
<cfargument name="category" type="string" required="false">
<cfargument name="currentTime" type="date" required="false">
</cffunction>
<cffunction name="isAvailable" access="public" returntype="boolean" >
</cffunction>
<cffunction name="delete" access="public" returntype="void" >
<cfargument name="key" required="true" type="string" />
<cfargument name="category" required="false" type="string">
</cffunction>
<cffunction name="clear" access="public" returntype="void" >
<cfargument name="category" required="false" type="string" />
</cffunction>
<cffunction name="getStats" access="public" returntype="Any" >
</cffunction></code></pre>
</li>
<li>
After you have implemented your storage option. Go to settings and override the <code>application.cacheonwheels.storage</code> property with the name of the storage option
you created in all lowercase.
</li>
<li>
Your new storage option should now be setup
</li>
</ol>