zoukankan      html  css  js  c++  java
  • Kohano之Cache篇

    Kohana缓存支持

        Apc

  • Eaccelerator
  • File
  • Memcache
  • Sqlite
  • Xcache
  • 统一有一个外部接口

    其中Memcachetag还实现了Kohana_Cache_Tagging 接口(注:Kohana_Cache_Tagging在API类表里把接口当类显示出来,TNND)

    下面简述下使用方法:

    创建配置文件:

    拷贝\modules\cache\config\cache.php 到 你的应用程序下就行了,修改你自己需要的,不在描述

    使用

    <?php
    $data="aaaaaaaaaaafasdfasaaaa";
    $cache=Cache::instance();
    $chachedata=$cache->get("foo");//取得缓存
    if(!$chachedata){
    	$cache->set('foo', $data);//设置缓存
    	$chachedata=$data;
    }
    echo $chachedata;
    //$cache->delete("foo");//删除缓存
    //$cache->delete_all();//删除全部缓存

    memcachetag 实现了Kohana_Cache_Tagging的方法:(下面使用示例)

    <?php
    $data="aaaaaaaaaaaaaaaaasdfaaaaaaaaaaaaa";
    $cache=Cache::instance("memcachetag");
    $chachedata=$cache->find("morea");
    if(!$chachedata){
    	$cache->set_with_tags('foo', $data,null,array("morea"));
    	$chachedata=$data;
    }
    echo $chachedata;
    //$cache->delete_tag("morea");
    //$cache->delete("foo");
    //$cache->delete_all();

查看全文
  • 相关阅读:
    Problem E. Matrix from Arrays(杭电2018年多校第四场+思维+打表找循环节)
    Reachability from the Capital(Codeforces Round #490 (Div. 3)+tarjan有向图缩点)
    Network of Schools(POJ1326+有向图进行缩点)
    John's trip(POJ1041+欧拉回路+打印路径)
    Watchcow(POJ2230+双向欧拉回路+打印路径)
    Network(POJ3694+边双连通分量+LCA)
    Problem L. Visual Cube(杭电多校2018年第三场+模拟)
    floyd骚操作——传递闭包
    Remmarguts' Date(POJ2449+最短路+A*算法)
    Transformation(线段树+HDU4578+多种操作+鬼畜的代码)
  • 原文地址:https://www.cnblogs.com/liushannet/p/1805149.html
  • Copyright © 2011-2022 走看看