1<?php
2
3
4class memcache_apc implements memcache_interface{
5	public static function init() {}
6
7	public static function driver(){ return "apc";}
8
9	public static function emulated() { return false; }
10
11	public static function add($key, $val,$ttl = 0){
12		if (MEMCACHE_CHECK_KEYS && !is_string($key)) trigger_error("The key needs to be string! (note: not even numbers are accepted)",E_USER_ERROR);
13		return apc_add($key,$val,$ttl);
14	}
15
16	public static function set($key, $val,$ttl = 0){
17		if (MEMCACHE_CHECK_KEYS && !is_string($key)) trigger_error("The key needs to be string! (note: not even numbers are accepted)",E_USER_ERROR);
18		return apc_store($key,$val,$ttl);
19	}
20
21	public static function exists($key){
22		if (MEMCACHE_CHECK_KEYS && !is_string($key)) trigger_error("The key needs to be string! (note: not even numbers are accepted)",E_USER_ERROR);
23		return apc_exists  ($key);
24	}
25
26	public static function del($key){
27		if (MEMCACHE_CHECK_KEYS && !is_string($key)) trigger_error("The key needs to be string! (note: not even numbers are accepted)",E_USER_ERROR);
28		return apc_delete  ($key);
29	}
30
31	public static function get($key,&$success = false){
32		if (MEMCACHE_CHECK_KEYS && !is_string($key)) trigger_error("The key needs to be string! (note: not even numbers are accepted)",E_USER_ERROR);
33		return apc_fetch   ($key, $success);
34	}
35
36	public static function clear(){
37		return apc_clear_cache ("user");
38	}
39
40}
41
42memcache_apc::init();