{"id":5471,"date":"2011-03-25T01:14:02","date_gmt":"2011-03-24T16:14:02","guid":{"rendered":"http:\/\/fukata.org\/?p=5471"},"modified":"2017-08-11T22:58:49","modified_gmt":"2017-08-11T22:58:49","slug":"codeigniter2-how-to-extends-cache","status":"publish","type":"post","link":"https:\/\/blog.fukata.org\/archives\/5471\/","title":{"rendered":"[CodeIgniter2.x]Cache\u30af\u30e9\u30b9\u3092\u7d99\u627f\u3059\u308b\u306b\u306f"},"content":{"rendered":"
[CodeIgniter2.x]Cache\u306e\u5229\u7528\u306b\u3064\u3044\u3066<\/a> \u524d\u56de\u3001\u524d\u3005\u56de\u3068CodeIgniter2\u304b\u3089\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308bCache\u6a5f\u80fd\u306b\u3064\u3044\u3066\u306e\u8a18\u4e8b\u3092\u66f8\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u3001\u3042\u308b\u8981\u4ef6\u3067\u65e2\u5b58\u306eCache\u30af\u30e9\u30b9\u3092\u7d99\u627f\u3059\u308b\u5fc5\u8981\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002\u901a\u5e38\u306elibrary\u3068\u306f\u7570\u306a\u308a\u30011\u968e\u5c64\u7570\u306a\u308a\u307e\u3059\u304c\u3001\u901a\u5e38\u901a\u308a\u7d99\u627f\u3067\u304d\u308b\u3060\u308d\u3046\u3068\u601d\u3044\u3001\u666e\u901a\u306bsystem\/libraries\/Cache\/Cache.php\u3092\u7d99\u627f\u3057\u305fMY_Cache.php\u3092application\/libraries\/Cache\/MY_Cache.php\u306b\u914d\u7f6e\u3057\u3066\u52d5\u304b\u3057\u3066\u307f\u308b\u3068\u898b\u4e8b\u306b\u843d\u3061\u307e\u3057\u305f\u3002<\/p>\n \u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u305d\u3093\u306a\u307e\u3060\u62e1\u5f35\u51fa\u6765\u306a\u3044Cache\u30af\u30e9\u30b9\u3002\u3082\u3068\u3044\u3001CI_Driver_Library\u30af\u30e9\u30b9\u3092\u7d99\u627f\u3057\u3066\u3044\u308b\u30af\u30e9\u30b9\u306e\u7d99\u627f\u65b9\u6cd5\u306b\u3064\u3044\u3066\u66f8\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n <\/p>\n \u76ee\u6b21<\/p> \u307e\u305a\u3001CI_Driver_Library\u3092\u7d99\u627f\u3057\u3066\u3044\u308b\u30af\u30e9\u30b9\u306e< \u7d99\u627f\u306b\u3064\u3044\u3066\u306f\u73fe\u6642\u70b9\uff082.0.1\uff09\u3067\u306f\u8003\u616e\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4eca\u5f8c\u3082\u8003\u616e\u3055\u308c\u308b\u304b\u3069\u3046\u304b\u306f\u308f\u304b\u308a\u307e\u305b\u3093\u3002\u4e00\u5fdc\u3001CodeIgniter Reactor\u306bPull Request\u306f\u884c\u3046\u3064\u3082\u308a\u3067\u3059\u3002\u306e\u3067\u3001\u4eca\u5f8c\u3001\u8003\u616e\u3055\u308c\u308b\u304b\u5206\u304b\u3089\u306a\u3044\u306e\u3067\u81ea\u5df1\u8cac\u4efb\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002\n\n\u6700\u521d\u306b\u8ff0\u3079\u305f\u3088\u3046\u306b\u4e0b\u8a18\u306e\u3088\u3046\u306bCache\u30af\u30e9\u30b9\u3092\u7d99\u627f\u3057\u305f\u3082\u306e\u3092\u914d\u7f6e\u3057\u3066\u307f\u307e\u3059\u3002\u30b9\u30c8\u30ec\u30fc\u30b8\u306f\u524d\u56de\u3068\u540c\u3058\u3088\u3046\u306bmemcached\u3092\u5229\u7528\u3057\u307e\u3059\u3002\n\n\n\n \u305f\u3060\u3001Cache\u3092\u7d99\u627f\u3057\u305f\u3060\u3051\u306eMY_Cache\u3067\u3059\u3002<\/p>\n \u307e\u305a\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u4e0b\u8a18\u306e\u3088\u3046\u306bwelcome.php\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u5229\u7528\u3092\u3059\u308b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u307f\u3066\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n \u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u308b\u3068\u3002\u3002\u3002<\/p>\n \u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u306d\u3002\u3053\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u3069\u3053\u3067\u547c\u3070\u308c\u3066\u3044\u308b\u304b\u3068\u3044\u3046\u3068\u3001\u4e0b\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n 767\u884c\u76ee\u4ed8\u8fd1\u3067\u3059\u3002\u7d99\u627f\u3055\u308c\u308b\u3079\u304d\u30b9\u30fc\u30d1\u30af\u30e9\u30b9\u306f\u3001system\/libraries\/\u76f4\u4e0b\u306b\u5b58\u5728\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3088\u3046\u3067\u3059\u3002<\/p>\n \u3053\u3053\u3067\u5c11\u3057\u304a\u304b\u3057\u306a\u30b3\u30fc\u30c9\u304c\u5b58\u5728\u3057\u307e\u3059\u3002\u30b5\u30d6\u30af\u30e9\u30b9\u306f\u968e\u5c64\u5316\u3055\u308c\u308b\u3053\u3068\u3092\u8003\u616e\u3057\u3066\u3044\u308b\u306b\u3082\u95a2\u308f\u3089\u305a\u3001\u30b9\u30fc\u30d1\u30af\u30e9\u30b9\u306b\u95a2\u3057\u3066\u306f\u3001\u968e\u5c64\u5316\u304c\u8003\u616e\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n \u3058\u3083\u3042\u3001\u8ffd\u52a0\u3059\u308c\u3070\u3044\u3044\u3058\u3083\u3093\u3002<\/p>\n \u3068\u3044\u3046\u3053\u3068\u3067\u3001\u8ffd\u52a0\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n \u3053\u306e\u72b6\u614b\u3067\u3082\u3046\u4e00\u5ea6\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n \u826f\u3044\u50be\u5411\u3067\u3059\u306d\u3002\u3069\u3046\u3084\u3089MY_Cache\u306f\u8aad\u307f\u8fbc\u307e\u308c\u305f\u3088\u3046\u3067\u3059\u3002\u305f\u3060\u3001\u307e\u3060\u307e\u3060\u5148\u306f\u9577\u305d\u3046\u3067\u3059\u3002\u3002\u3002<\/p>\n CodeIgniter 2\u306e\u30bd\u30fc\u30b9\u3092\u898b\u305f\u3053\u3068\u304c\u3042\u308b\u65b9\u306f\u3082\u3046\u898b\u3048\u3066\u304d\u307e\u3057\u305f\u306d\u3002\u305f\u3060\u3001\u8aac\u660e\u306f\u307e\u3060\u307e\u3060\u7d9a\u304d\u307e\u3059\u3002<\/p>\n \u5148\u307b\u3069\u51fa\u305f\u30a8\u30e9\u30fc\u3067\u3059\u304c\u3001\u30b3\u30ec\u306f\u4e0b\u8a18\u306e\u4e00\u756a\u4e0b\u306e\u65b9\u3067\u767a\u751f\u3057\u3066\u3044\u307e\u3059\u3002\u5177\u4f53\u7684\u306b\u3069\u3046\u3044\u3046\u3082\u306e\u304b\u3068\u3044\u3046\u3068\u3001\u307e\u305a\u3001__get\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u304c\u3001\u30b3\u30ec\u306f\u30de\u30b8\u30c3\u30af\u30e1\u30bd\u30c3\u30c9\u3068\u3044\u3046\u3082\u306e\u3067\u3001\u81ea\u8eab\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u3082\u306a\u3044\u306e\u306b\u53c2\u7167\u3057\u3088\u3046\u3068\u3057\u305f\u5834\u5408\u306b\u547c\u3070\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002Cache.php\u3092\u4f8b\u306b\u3057\u3066\u8aac\u660e\u3059\u308b\u3068\u3001\u4f8b\u3048\u3070\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n \u3055\u3089\u306b\u4e0a\u8a18\u306e\u90e8\u5206\u306e\u3053\u3053\u3067\u3059\u3002<\/p>\n \u5b9f\u884c\u6642\u306b\u306f{$this->_adapter}\u304c\u5c55\u958b\u3055\u308c\u3066\u5b9f\u969b\u306b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n Cache.php\u306b\u306fmemcached\u306a\u3093\u3066\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u3042\u308a\u307e\u305b\u3093\u3088\u306d\uff1f\u306a\u306e\u3067\u3001\u30b9\u30fc\u30d1\u30af\u30e9\u30b9\u3067\u3042\u308bCI_Driver_Library\u306e__get\u30e1\u30bd\u30c3\u30c9\u304c\u547c\u3070\u308c\u307e\u3059\u3002\u3055\u3089\u306b\u3053\u306e\u6642\u3001\u91cd\u8981\u306a\u306e\u304c\u3001__get\u306e\u5f15\u6570\u306b\u306f\u3001\u30a2\u30af\u30bb\u30b9\u3057\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\u304c\u6e21\u3055\u308c\u307e\u3059\u3002\u5148\u7a0b\u306e\u4f8b\u306e\u5834\u5408\u3001\u300cmemcached\u300d\u304c\u4e0b\u8a18\u306e$child\u5909\u6570\u306b\u5165\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n CI_Driver_Library\u306e__get\u30e1\u30bd\u30c3\u30c9\u3067\u4f55\u3092\u3084\u3063\u3066\u3044\u308b\u304b\u3068\u3044\u3046\u3068\u3001\u30a2\u30af\u30bb\u30b9\u3057\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u540d\u79f0\u3092\u3082\u3068\u306bdrivers\u4ee5\u4e0b\u306b\u914d\u7f6e\u3055\u308c\u305f\u5b9f\u614b\u3092\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u3066\u3057\u307e\u304a\u3046\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002\u305f\u3060\u3001\u3053\u306e\u6642\u3001\u9069\u5f53\u306a\u540d\u524d\u3067\u306f\u306a\u304f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u540d\u524d\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n $this->lib_name\u306b\u306f\u3001\u81ea\u8eab\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3055\u308c\u3066\u3044\u308b\u30af\u30e9\u30b9\u540d\u3002\u4eca\u56de\u306e\u5834\u5408\u306fMY_Cache\u304c\u5165\u308a\u307e\u3059\u3002\u306e\u3067\u3001\u30b5\u30d6\u30af\u30e9\u30b9\u3068\u3057\u3066\u547c\u3073\u3060\u305d\u3046\u3068\u3057\u3066\u3044\u308b\u306e\u306f\u3001\u300cMY_Cache_memcached\u300d\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n \u307e\u305f\u3001MY_Cache_memcached\u306a\u3069\u3001\u5bfe\u8c61\u306e\u30af\u30e9\u30b9\u540d\u306b\u95a2\u3057\u3066\u306f\u3001MY_Cache.php\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u300cvalid_drivers\u300d\u306b\u4e0b\u8a18\u306e\u3088\u3046\u306b\u30af\u30e9\u30b9\u540d\u3092\u5c0f\u6587\u5b57\u5316\u3057\u305f\u3082\u306e\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n \u3055\u3089\u306b\u4e0b\u8a18\u306e\u3088\u3046\u306bdrivers\/\u914d\u4e0b\u306b\u30af\u30e9\u30b9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n \u3053\u308c\u3067\u3001\u3084\u3063\u3068\u7d42\u308f\u308a\u3067\u3059\u306d\u3002\u307e\u305f\u3001\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n \u5909\u308f\u3063\u3066\u3044\u307e\u305b\u3093\u306d\u3002\u3002\u3002\u56f0\u3063\u305f\u6642\u306f\u30ed\u30b0\u51fa\u529b\u3092\u6700\u5927\u306b\u3057\u3066\u4f55\u304c\u8868\u793a\u3055\u308c\u308b\u304b\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n \u3069\u3046\u3084\u3089\u3001\u5148\u307b\u3069\u306eCI_Driver_Library\u306e__get\u30e1\u30bd\u30c3\u30c9\u5185\u3067MY_Cache_memcached\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u3068\u8a00\u308f\u308c\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002CI_Driver_Library\u306b\u30ed\u30b0\u3092\u8ffd\u52a0\u3057\u3066\u8aad\u307f\u8fbc\u3082\u3046\u3068\u3057\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3092\u51fa\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n \u30ed\u30b0\u3092\u8ffd\u52a0\u5f8c\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u3053\u3093\u306a\u30ed\u30b0\u304c\u51fa\u307e\u3057\u305f\u3002<\/p>\n \u60f3\u5b9a\u3057\u3066\u3044\u305f<\/p>\n \u3067\u306f\u306a\u304f\u3001<\/p>\n \u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n \u3053\u308c\u306f\u3001\u5148\u307b\u3069\u30ed\u30b0\u3092\u8ffd\u52a0\u3057\u305f\u76f4\u524d\u306e\u30b3\u30fc\u30c9\u3092\u898b\u308c\u3070\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n lib_name\u306f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3055\u308c\u3066\u3044\u308b\u30af\u30e9\u30b9\u540d\u3060\u3063\u305f\u306e\u3067\u3001\u300cMY_Cache\u300d\u306b\u306a\u308a\u307e\u3059\u306d\u3002\u3088\u3063\u3066\u3001drivers\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u79fb\u52d5\u3057\u307e\u3059\u3002\u79fb\u52d5\u5f8c\u306eapplication\/libraries\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e2d\u8eab\u306f\u3053\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n \u3053\u308c\u3067\u3001\u3082\u3046\u4e00\u5ea6\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n \u30b5\u30d6\u30af\u30e9\u30b9\u5316\u304c\u8003\u616e\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u30b9\u30fc\u30d1\u30af\u30e9\u30b9\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u308f\u3051\u304c\u3042\u308a\u307e\u305b\u3093\u306d\u30fb\u30fb\u30fb\u3002\u3068\u3044\u3046\u3053\u3068\u3067\u3001drivers\/\u914d\u4e0b\u306e\u305d\u308c\u305e\u308c\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u6c5a\u3044\u3067\u3059\u304c\u3001require_once\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n \u3053\u308c\u3067\u3001\u518d\u5ea6\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n \u3084\u3063\u3068\u8868\u793a\u3055\u308c\u307e\u3057\u305f\uff01\uff01\uff01\u3053\u308c\u3067\u3001Cache.php\u306e\u62e1\u5f35\u304c\u51fa\u6765\u307e\u3057\u305f\u3002\u6700\u5f8c\u306bCache\u3084CI_Driver_Library\u3092\u30b9\u30fc\u30d1\u30af\u30e9\u30b9\u306b\u6301\u3064\u30af\u30e9\u30b9\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u5316\u306b\u3064\u3044\u3066\u306f\u307e\u3060\u8003\u616e\u3055\u308c\u3066\u3044\u306a\u3044\u3067\u3059\u3057\u3001\u8003\u616e\u3057\u3088\u3046\u3068\u3057\u305f\u5f62\u8de1\u304c\u898b\u3089\u308c\u308b\u30b3\u30fc\u30c9\u3082\u898b\u5f53\u305f\u308a\u307e\u305b\u3093\u3002\u3088\u3063\u3066\u3001\u4eca\u56de\u306eCache\u30af\u30e9\u30b9\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u5316\u306b\u3064\u3044\u3066\u306f\u6fc0\u3057\u304f\u81ea\u5df1\u8cac\u4efb\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002<\/p>\n CodeIgniter\u306e\u4e2d\u306e\u4eba\u304c\u3053\u306e\u8fba\u3082\u30b5\u30d6\u30af\u30e9\u30b9\u5316\u3092\u8996\u91ce\u306b\u5165\u308c\u3066\u3044\u308b\u306e\u304b\u308f\u304b\u308a\u307e\u305b\u3093\u304c\u3001\u5b9f\u969b\u306e\u6848\u4ef6\u3067\u306f\u8981\u4ef6\u3068\u3057\u3066\u30b5\u30d6\u30af\u30e9\u30b9\u5316\u3057\u305f\u3044\u4e8b\u3082\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u306a\u306e\u3067\u3001\u3082\u3046\u5c11\u3057\u30b9\u30de\u30fc\u30c8\u306b\u30b5\u30d6\u30af\u30e9\u30b9\u5316\u3067\u304d\u308b\u3088\u3046\u306b\u4fee\u6b63\u3057\u305f\u3082\u306e\u3092Pull Request\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n \u3068\u308a\u3042\u3048\u305a\u3001Issue\u306b\u8ffd\u52a0\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u3044\u3064\u3082\u306e\u3088\u3046\u306b\u82f1\u8a9e\u306fGoogle\u7ffb\u8a33\u306e\u3082\u306e\u3092\u305d\u306e\u307e\u307e\u5229\u7528\u3057\u3066\u3044\u308b\u306e\u3067\u898b\u82e6\u3057\u3044\u90e8\u5206\u306f\u3042\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002\u3002\u3002<\/p>\n ellislab \/ CodeIgniter Reactor \/ issues \/ #163 – extends Cache class \u2014 Bitbucket<\/a><\/p>\n","protected":false},"excerpt":{"rendered":" [CodeIgniter2.x]Cache\u306e\u5229\u7528\u306b\u3064\u3044\u3066 [CodeIgniter]CodeIgniter2\u306eCache\u6a5f\u80fd\u3092CodeIgniter1\u7cfb\u3067\u3082\u5229\u7528\u3059\u308b\u30d1\u30c3\u30c1 \u524d\u56de\u3001\u524d\u3005\u56de\u3068CodeIgn … \u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":9223372036854775807,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1980],"tags":[850],"_links":{"self":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/5471"}],"collection":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/comments?post=5471"}],"version-history":[{"count":0,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/5471\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media\/9223372036854775807"}],"wp:attachment":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media?parent=5471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/categories?post=5471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/tags?post=5471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\n[CodeIgniter]CodeIgniter2\u306eCache\u6a5f\u80fd\u3092CodeIgniter1\u7cfb\u3067\u3082\u5229\u7528\u3059\u308b\u30d1\u30c3\u30c1<\/a><\/p>\n\u3068\u308a\u3042\u3048\u305a\u7d99\u627f\u3057\u3066\u307f\u308b<\/span><\/h2>\n
application\/config\/cache.php<\/p>\n
\r\n< ?php\r\n$config = array(\r\n\t'adapter' => 'memcached',\r\n);\r\n<\/pre>\n
application\/config\/memcached.php<\/span><\/h3>\n
\r\n< ?php\r\n$config = array(\r\n\t'cache1' => array(\r\n\t\t'hostname' => '127.0.0.1',\r\n\t\t'port' => 11211,\r\n\t\t'weight' => 1,\r\n\t),\r\n);\r\n<\/pre>\n
application\/libraries\/Cache\/MY_Cache.php<\/span><\/h3>\n
\r\n< ?php\r\nclass MY_Cache extends Cache {\r\n}\r\n<\/pre>\n
application\/controller\/welcome.php<\/span><\/h3>\n
\r\n\tpublic function index()\r\n\t{\r\n\t\t$this->load->driver('cache');\r\n\t\t$this->cache->save('hoge', 'foo', 3600);\r\n\t\t$hoge = $this->cache->get('hoge');\r\n\t\tvar_dump($hoge);\r\n\r\n\t\t$this->load->view('welcome_message');\r\n\t}\r\n<\/pre>\n
\r\nAn Error Was Encountered\r\nUnable to load the requested class: Cache\r\n<\/pre>\n
\u8db3\u308a\u306a\u3051\u308c\u3070\u8ffd\u52a0\u3059\u308c\u3070\u3044\u3044\u3058\u3083\u306a\u3044<\/span><\/h2>\n
system\/core\/Loader.php<\/span><\/h3>\n
\r\n $subclass = APPPATH.'libraries\/'.$subdir.config_item('subclass_prefix').$class.EXT;\r\n\r\n \/\/ Is this a class extension request?\r\n if (file_exists($subclass))\r\n { \r\n $baseclass = BASEPATH.'libraries\/'.ucfirst($class).EXT;\r\n\r\n if ( ! file_exists($baseclass))\r\n { \r\n log_message('error', \"Unable to load the requested class: \".$class);\r\n show_error(\"Unable to load the requested class: \".$class);\r\n } \r\n<\/pre>\n
\r\n $subclass = APPPATH.'libraries\/'.$subdir.config_item('subclass_prefix').$class.EXT;\r\n<\/pre>\n
\r\n $subclass = APPPATH.'libraries\/'.$subdir.config_item('subclass_prefix').$class.EXT;\r\n\r\n \/\/ Is this a class extension request?\r\n if (file_exists($subclass))\r\n { \r\n- $baseclass = BASEPATH.'libraries\/'.ucfirst($class).EXT;\r\n+ $baseclass = BASEPATH.'libraries\/'.$subdir.ucfirst($class).EXT;\r\n if ( ! file_exists($baseclass))\r\n { \r\n log_message('error', \"Unable to load the requested class: \".$class);\r\n show_error(\"Unable to load the requested class: \".$class);\r\n } \r\n<\/pre>\n
\r\nAn Error Was Encountered\r\nInvalid driver requested: MY_Cache_memcached\r\n<\/pre>\n
drivers\u3082\u7d99\u627f\u3057\u3066\u306d<\/span><\/h2>\n
system\/libraries\/Driver.php<\/span><\/h3>\n
\r\n public function get($id)\r\n {\r\n return $this->{$this->_adapter}->get($id);\r\n }\r\n<\/pre>\n
\r\nreturn $this->{$this->_adapter}->get($id);\r\n<\/pre>\n
\r\nreturn $this->memcached->get($id);\r\n<\/pre>\n
\r\n function __get($child)\r\n {\r\n if ( ! isset($this->lib_name))\r\n {\r\n $this->lib_name = get_class($this);\r\n }\r\n\r\n \/\/ The class will be prefixed with the parent lib\r\n $child_class = $this->lib_name.'_'.$child;\r\n\r\n if (in_array(strtolower($child_class), array_map('strtolower', $this->valid_drivers)))\r\n {\r\n \/\/ check and see if the driver is in a separate file\r\n if ( ! class_exists($child_class))\r\n {\r\n \/\/ check application path first\r\n foreach (array(APPPATH, BASEPATH) as $path)\r\n {\r\n \/\/ and check for case sensitivity of both the parent and child libs\r\n foreach (array(ucfirst($this->lib_name), strtolower($this->lib_name)) as $lib)\r\n {\r\n \/\/ loves me some nesting!\r\n foreach (array(ucfirst($child_class), strtolower($child_class)) as $class)\r\n {\r\n $filepath = $path.'libraries\/'.$this->lib_name.'\/drivers\/'.$child_class.EXT;\r\n\r\n if (file_exists($filepath))\r\n {\r\n include_once $filepath;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n \/\/ it's a valid driver, but the file simply can't be found\r\n if ( ! class_exists($child_class))\r\n {\r\n log_message('error', \"Unable to load the requested driver: \".$child_class);\r\n show_error(\"Unable to load the requested driver: \".$child_class);\r\n }\r\n }\r\n\r\n $obj = new $child_class;\r\n $obj->decorate($this);\r\n $this->$child = $obj;\r\n return $this->$child;\r\n }\r\n\r\n \/\/ The requested driver isn't valid!\r\n log_message('error', \"Invalid driver requested: \".$child_class);\r\n show_error(\"Invalid driver requested: \".$child_class);\r\n }\r\n<\/pre>\n
\r\n if ( ! isset($this->lib_name))\r\n {\r\n $this->lib_name = get_class($this);\r\n }\r\n\r\n \/\/ The class will be prefixed with the parent lib\r\n $child_class = $this->lib_name.'_'.$child;\r\n<\/pre>\n
\r\n< ?php\r\nclass MY_Cache extends Cache {\r\n protected $valid_drivers = array(\r\n 'my_cache_apc', 'my_cache_file', 'my_cache_memcached', 'my_cache_dummy'\r\n );\r\n}\r\n<\/pre>\n
application\/libraries\/Cache\/drivers\/MY_Cache_apc.php<\/span><\/h3>\n
\r\n< ?php\r\nclass MY_Cache_apc extends Cache_apc {\r\n}\r\n<\/pre>\n
application\/libraries\/Cache\/drivers\/MY_Cache_file.php<\/span><\/h3>\n
\r\n< ?php\r\nclass MY_Cache_file extends Cache_file {\r\n}\r\n<\/pre>\n
application\/libraries\/Cache\/drivers\/MY_Cache_memcached.php<\/span><\/h3>\n
\r\n< ?php\r\nclass MY_Cache_memcached extends Cache_memcached {\r\n}\r\n<\/pre>\n
application\/libraries\/Cache\/drivers\/MY_Cache_dummy.php<\/span><\/h3>\n
\r\n< ?php\r\nclass MY_Cache_dummy extends Cache_dummy {\r\n}\r\n<\/pre>\n
\r\nAn Error Was Encountered\r\nUnable to load the requested driver: MY_Cache_memcached\r\n<\/pre>\n
\r\nDEBUG - 2011-03-24 23:39:17 --> Loader Class Initialized\r\nDEBUG - 2011-03-24 23:39:17 --> Controller Class Initialized\r\nERROR - 2011-03-24 23:39:17 --> Unable to load the requested driver: MY_Cache_memcached\r\n<\/pre>\n
\r\n $filepath = $path.'libraries\/'.$this->lib_name.'\/drivers\/'.$child_class.EXT;\r\n+ log_message('debug', \"load driver=$filepath\");\r\n<\/pre>\n
\r\nDEBUG - 2011-03-24 23:42:47 --> Controller Class Initialized\r\nDEBUG - 2011-03-24 23:42:47 --> load driver=application\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php\r\nDEBUG - 2011-03-24 23:42:47 --> load driver=application\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php\r\nDEBUG - 2011-03-24 23:42:47 --> load driver=application\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php\r\nDEBUG - 2011-03-24 23:42:47 --> load driver=application\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php\r\nDEBUG - 2011-03-24 23:42:47 --> load driver=\/home\/tatsuya\/workspace\/hg\/fukata-codeigniter-reactor\/system\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php\r\nDEBUG - 2011-03-24 23:42:47 --> load driver=\/home\/tatsuya\/workspace\/hg\/fukata-codeigniter-reactor\/system\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php\r\nDEBUG - 2011-03-24 23:42:47 --> load driver=\/home\/tatsuya\/workspace\/hg\/fukata-codeigniter-reactor\/system\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php\r\nDEBUG - 2011-03-24 23:42:47 --> load driver=\/home\/tatsuya\/workspace\/hg\/fukata-codeigniter-reactor\/system\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php\r\nERROR - 2011-03-24 23:42:47 --> Unable to load the requested driver: MY_Cache_memcached\r\n<\/pre>\n
application\/libraries\/Cache\/drivers\/MY_Cache_memcached.php<\/pre>\n
application\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php<\/pre>\n
\r\n$filepath = $path.'libraries\/'.$this->lib_name.'\/drivers\/'.$child_class.EXT;\r\n<\/pre>\n
\r\n.\/\r\n|-- Cache\r\n| `-- MY_Cache.php\r\n|-- MY_Cache\r\n| `-- drivers\r\n| |-- MY_Cache_apc.php\r\n| |-- MY_Cache_dummy.php\r\n| |-- MY_Cache_file.php\r\n| `-- MY_Cache_memcached.php\r\n`-- index.html\r\n<\/pre>\n
\r\nFatal error: Class 'Cache_memcached' not found in \/home\/tatsuya\/workspace\/hg\/fukata-codeigniter-reactor\/application\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php on line 2\r\n<\/pre>\n
application\/libraries\/MY_Cache\/drivers\/MY_Cache_apc.php<\/span><\/h3>\n
\r\n< ?php\r\nrequire_once BASEPATH.'libraries\/Cache\/drivers\/Cache_apc.php';\r\nclass MY_Cache_apc extends Cache_apc {\r\n}\r\n<\/pre>\n
application\/libraries\/MY_Cache\/drivers\/MY_Cache_file.php<\/span><\/h3>\n
\r\n< ?php\r\nrequire_once BASEPATH.'libraries\/Cache\/drivers\/Cache_file.php';\r\nclass MY_Cache_file extends Cache_file {\r\n}\r\n<\/pre>\n
application\/libraries\/MY_Cache\/drivers\/MY_Cache_memcached.php<\/span><\/h3>\n
\r\n< ?php\r\nrequire_once BASEPATH.'libraries\/Cache\/drivers\/Cache_memcached.php';\r\nclass MY_Cache_memcached extends Cache_memcached {\r\n}\r\n<\/pre>\n
application\/libraries\/MY_Cache\/drivers\/MY_Cache_dummy.php<\/span><\/h3>\n
\r\n< ?php\r\nrequire_once BASEPATH.'libraries\/Cache\/drivers\/Cache_dummy.php';\r\nclass MY_Cache_dummy extends Cache_dummy {\r\n}\r\n<\/pre>\n
\r\nstring(3) \"foo\"\r\n<\/pre>\n