You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
52
extend/app_alipay/lotusphp_runtime/Cache/CacheHandle.php
Executable file
52
extend/app_alipay/lotusphp_runtime/Cache/CacheHandle.php
Executable file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
class LtCacheHandle
|
||||
{
|
||||
public $configHandle;
|
||||
public $group;
|
||||
public $node;
|
||||
public $role = "master";
|
||||
public $connectionManager;
|
||||
public $connectionResource;
|
||||
protected $connectionAdapter;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->connectionManager = new LtCacheConnectionManager;
|
||||
$this->connectionManager->configHandle =$this->configHandle;
|
||||
}
|
||||
|
||||
public function add($key, $value, $ttl = 0, $tableName)
|
||||
{
|
||||
$this->initConnection();
|
||||
return $this->connectionAdapter->add($key, $value, $ttl, $tableName, $this->connectionResource);
|
||||
}
|
||||
|
||||
public function del($key, $tableName)
|
||||
{
|
||||
$this->initConnection();
|
||||
return $this->connectionAdapter->del($key, $tableName, $this->connectionResource);
|
||||
}
|
||||
|
||||
public function get($key, $tableName)
|
||||
{
|
||||
$this->initConnection();
|
||||
return $this->connectionAdapter->get($key, $tableName, $this->connectionResource);
|
||||
}
|
||||
|
||||
public function update($key, $value, $ttl = 0, $tableName)
|
||||
{
|
||||
$this->initConnection();
|
||||
return $this->connectionAdapter->update($key, $value, $ttl, $tableName, $this->connectionResource);
|
||||
}
|
||||
|
||||
protected function initConnection()
|
||||
{
|
||||
$connectionInfo = $this->connectionManager->getConnection($this->group, $this->node, $this->role);
|
||||
$this->connectionAdapter = $connectionInfo["connectionAdapter"];
|
||||
$this->connectionResource = $connectionInfo["connectionResource"];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user