summaryrefslogtreecommitdiff
path: root/includes/objectcache/eAccelBagOStuff.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/objectcache/eAccelBagOStuff.php')
-rw-r--r--includes/objectcache/eAccelBagOStuff.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/includes/objectcache/eAccelBagOStuff.php b/includes/objectcache/eAccelBagOStuff.php
new file mode 100644
index 00000000..30d24e80
--- /dev/null
+++ b/includes/objectcache/eAccelBagOStuff.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * This is a wrapper for eAccelerator's shared memory functions.
+ *
+ * This is basically identical to the deceased Turck MMCache version,
+ * mostly because eAccelerator is based on Turck MMCache.
+ *
+ * @ingroup Cache
+ */
+class eAccelBagOStuff extends BagOStuff {
+ public function get( $key ) {
+ $val = eaccelerator_get( $key );
+
+ if ( is_string( $val ) ) {
+ $val = unserialize( $val );
+ }
+
+ return $val;
+ }
+
+ public function set( $key, $value, $exptime = 0 ) {
+ eaccelerator_put( $key, serialize( $value ), $exptime );
+
+ return true;
+ }
+
+ public function delete( $key, $time = 0 ) {
+ eaccelerator_rm( $key );
+
+ return true;
+ }
+
+ public function lock( $key, $waitTimeout = 0 ) {
+ eaccelerator_lock( $key );
+
+ return true;
+ }
+
+ public function unlock( $key ) {
+ eaccelerator_unlock( $key );
+
+ return true;
+ }
+}
+