php自用数据缓存类

来源:互联网 发布:js cst时间格式化 编辑:程序博客网 时间:2024/06/07 07:24

刚换了一个工作,现在没什么事做,写了一个数据缓存的类。

可以缓存数组,字符,对象等,执行效率还没有测试,先放出来吧。

实例如下:

 

 * @example

 * require 'MyCache.class.php';

 * $mc = new MyCache("./test/cache");

 * $a = "hello world111";

 * $mc->set("ss", $a);

 * $mc->set("dd", $mc);

 * $mc->set("2s", $a);

 * echo $mc->get("ss");

 * $mc->delete("2s");

 * $mc->edit("ss", "hello");

 * echo $mc->get_type("dd");

 * echo "<pre>";

 * print_r($c);

 

 

原创粉丝点击