123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- if (!defined('STATUSNET')) {
-
-
- exit(1);
- }
- class XCachePlugin extends Plugin
- {
-
- function onStartCacheGet(&$key, &$value)
- {
- if (!xcache_isset($key)) {
- $value = false;
- } else {
- $value = xcache_get($key);
- $value = unserialize($value);
- }
- Event::handle('EndCacheGet', array($key, &$value));
- return false;
- }
-
- function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success)
- {
- $success = xcache_set($key, serialize($value));
- Event::handle('EndCacheSet', array($key, $value, $flag,
- $expiry));
- return false;
- }
-
- function onStartCacheDelete(&$key, &$success)
- {
- $success = xcache_unset($key);
- Event::handle('EndCacheDelete', array($key));
- return false;
- }
- function onPluginVersion(&$versions)
- {
- $versions[] = array('name' => 'XCache',
- 'version' => GNUSOCIAL_VERSION,
- 'author' => 'Craig Andrews',
- 'homepage' => 'http://status.net/wiki/Plugin:XCache',
- 'rawdescription' =>
-
- _m('Use the <a href="http://xcache.lighttpd.net/">XCache</a> variable cache to cache query results.'));
- return true;
- }
- }
|