Example #1
0
 public function create_key($key)
 {
     if (isset($key[201])) {
         return parent::create_key($key);
     }
     return sprintf("%s/%s/%s", base_kvstore::kvprefix(), $this->prefix, $key);
 }
Example #2
0
 function __construct($prefix)
 {
     if (!isset(self::$_mongodb)) {
         $server = defined('MONGODB_SERVER_CONFIG') ? MONGODB_SERVER_CONFIG : "mongodb://localhost:27017";
         $option = defined('MONGODB_OPTION_CONFIG') ? eval(MONGODB_OPTION_CONFIG) : array("connect" => TRUE);
         $m = new MongoClient($server, $option);
         $db = $m->vmcshop_kvstore;
         self::$_mongodb = $db->selectCollection(base_kvstore::kvprefix());
     }
     $this->prefix = $prefix;
 }
Example #3
0
 function __construct($prefix)
 {
     if (!isset(self::$_mongodb)) {
         $hosts = (array) config::get('kvstore.base_kvstore_mongodb.hosts', 'mongodb://localhost:27017');
         $options = config::get('kvstore.base_kvstore_mongodb.options', array("connect" => TRUE));
         $hosts = implode(',', $hosts);
         $m = new MongoClient($hosts, $options);
         $db = $m->ecos;
         //todo 需要改成config配置
         self::$_mongodb = $db->selectCollection(base_kvstore::kvprefix());
     }
     $this->prefix = $prefix;
 }
Example #4
0
 function __construct($prefix)
 {
     if (!isset(self::$_mongodb)) {
         $server = defined('MONGODB_SERVER_CONFIG') ? MONGODB_SERVER_CONFIG : "mongodb://localhost:27017";
         $option = defined('MONGODB_OPTION_CONFIG') ? eval(MONGODB_OPEION_CONFIG) : array("connect" => TRUE);
         $m = new Mongo($server, $option);
         // var_dump($m);exit;
         $db = $m->ecos;
         //todo 需要改成config配置
         self::$_mongodb = $db->selectCollection(base_kvstore::kvprefix());
     }
     $this->prefix = $prefix;
 }
Example #5
0
 public function index()
 {
     $this->pagedata['enable'] = get_class(cachemgr::instance()) == 'base_cache_nocache' ? 'false' : 'true';
     if (cachemgr::status($status)) {
         // foreach ($status as $key => $value) {
         //     $status_obj[] = array(
         //         'label'=>$key,
         //         'data'=>$value
         //     );
         // }
         $this->pagedata['status'] = $status;
     }
     $this->pagedata['cache_name'] = cachemgr::instance()->name;
     $this->pagedata['static_cache'] = array();
     $this->pagedata['syscache'] = array('setting_cache' => syscache::instance('setting')->get_status(), 'service_cache' => syscache::instance('service')->get_status());
     $this->pagedata['kvstore'] = array('name' => vmc::singleton('base_kvstore')->get_controller()->name, 'kvprefix' => base_kvstore::kvprefix());
     foreach (vmc::servicelist('site.router.cache') as $value) {
         if (!method_exists($value, 'get_cache_methods')) {
             continue;
         }
         $methods = $value->get_cache_methods();
         foreach ((array) $methods as $method) {
             if (isset($method['app']) && isset($method['ctl']) && isset($method['act'])) {
                 $expires = app::get('site')->getConf($method['app'] . '_' . $method['ctl'] . '_' . $method['act'] . '.cache_expires');
                 if ($expires !== null) {
                     $method['expires'] = $expires;
                 }
                 $this->pagedata['static_cache'][] = $method;
             }
         }
     }
     foreach (vmc::servicelist('mobile.router.cache') as $value) {
         if (!method_exists($value, 'get_cache_methods')) {
             continue;
         }
         $methods = $value->get_cache_methods();
         foreach ((array) $methods as $method) {
             if (isset($method['app']) && isset($method['ctl']) && isset($method['act'])) {
                 $expires = app::get('mobile')->getConf($method['app'] . '_' . $method['ctl'] . '_' . $method['act'] . '.cache_expires');
                 if ($expires !== null) {
                     $method['expires'] = $expires;
                 }
                 $this->pagedata['mstatic_cache'][] = $method;
             }
         }
     }
     $this->page('cachestage/index.html');
 }
Example #6
0
 function __construct($prefix)
 {
     if (!isset(self::$_mongodb)) {
         $server = defined('MONGODB_SERVER_CONFIG') ? MONGODB_SERVER_CONFIG : "mongodb://localhost:27017";
         $option = defined('MONGODB_OPTION_CONFIG') ? eval(MONGODB_OPEION_CONFIG) : array("connect" => TRUE);
         $m = new Mongo($server, $option);
         // Andrew 20121023
         // 更改collection名称
         $db = $m->tnf_store;
         //todo 需要改成config配置
         self::$_mongodb = $db->selectCollection(base_kvstore::kvprefix());
         // Andrew 20121120
         self::$_mongodb->ensureIndex(array('key' => 1));
     }
     $this->prefix = $prefix;
 }
Example #7
0
 public function create_key($key)
 {
     return md5(base_kvstore::kvprefix() . $this->prefix . $key);
 }