Open Sencillo  2015.107
Long live the simplicity of PHP
 All Data Structures Namespaces Functions Pages
template.php
1 <?php
2 /*~ template.php
3 .---------------------------------------------------------------------------.
4 | Software: SencilloCache |
5 | Version: 2015.003 |
6 | Contact: ph@mastery.sk |
7 | ------------------------------------------------------------------------- |
8 | Author: Bc. Peter Horváth |
9 | Copyright (c) 2015, Bc. Peter Horváth. All Rights Reserved. |
10 | ------------------------------------------------------------------------- |
11 | License: Distributed under the General Public License (GPL) |
12 | http://www.gnu.org/licenses/gpl-3.0.html |
13 | This program is distributed in the hope that it will be useful - WITHOUT |
14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
15 | FITNESS FOR A PARTICULAR PURPOSE. |
16 '---------------------------------------------------------------------------'
17 ~*/
18 
19 /* Template for other types of cache
20  * You'll need to implement these 5 functions, add
21  * additional functions inhere.
22  *
23  * Add variables you use to quickcache_config.php
24  *
25  * When you've implemented a new storage-system, and think that the world
26  * could/should use it too, please submit it to me (andy.prevost@worxteam.com),
27  * and we will include it in a next release (with full credits, of course).
28  */
29 
30 /* quickcache_restore()
31  * Will (try to) restore the cachedata.
32  */
33 function quickcache_restore() {
34  global $QUICKCACHE_TIME, $cache_key, $cachedata_gzdata, $cachedata_datasize, $cachedata_datacrc;
35 
36  // Implement restoring of cached data
37  //
38  // Use $cache_key to lookup data, use $JPACHE_TIME to check if
39  // data is still valid.
40  //
41  // If data-retrieval was succesfull, you'll need to set
42  // $cachedata_gzdata, $cachedata_datasize and $cachedata_datacrc
43  // and return true, if unsuccesfull, return false.
44 
45  return false;
46 }
47 
48 /* quickcache_write()
49  * Will (try to) write out the cachedata to the db
50  */
51 function quickcache_write($gzcontents, $size, $crc32) {
52  global $QUICKCACHE_TIME, $QUICKCACHE_ON, $cache_key;
53 
54  // Implement writing of the data as given.
55  // Store on $cache_key and add a 'field' for $QUICKCACHE_TIME
56  // Store the 3 parameters seperatly
57 }
58 
59 /* quickcache_do_gc()
60  * Performs the actual garbagecollection
61  */
62 function quickcache_do_gc() {
63  // Implement garbage-collection
64 }
65 
66 
67 /* quickcache_do_start()
68  * Additional code that is executed before real quickcache-code kicks
69  */
70 function quickcache_do_start() {
71  // Add additional code you might require
72 }
73 
74 /* quickcache_do_end()
75  * Additional code that us executed after caching has been performed,
76  * but just before output is returned. No new output can be added.
77  */
78 function quickcache_do_end() {
79  // Add additional code you might require
80 }
81 
82 // Make sure no additional lines/characters are after the closing-tag!
83 ?>