本文整理汇总了PHP中dba_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP dba_delete函数的具体用法?PHP dba_delete怎么用?PHP dba_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dba_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete cache
* @param string $id
* @return boolean
*/
public function delete($key)
{
if (!dba_exists($key, $this->_handler('r'))) {
return true;
}
return dba_delete($key, $this->_handler('w'));
}
示例2: delete
public function delete($key)
{
$rs = dba_open(DATA_DIR . '/kvstore/dba.db', 'wl', $this->handle);
$ret = dba_delete($this->create_key($key), $rs);
dba_close($rs);
return $ret;
}
示例3: new_access_token
function new_access_token($token, $consumer)
{
/*{{{*/
$token = $this->new_token($consumer, 'access');
dba_delete("request_" . $token->key, $this->dbh);
return $token;
}
示例4: db4_delete
function db4_delete($key)
{
return dba_delete(bin4($key), $GLOBALS['db']);
}
示例5: add
function add($key, $value, $exptime = 0)
{
wfProfileIn(__METHOD__);
$blob = $this->encode($value, $exptime);
$handle = $this->getWriter();
if (!$handle) {
wfProfileOut(__METHOD__);
return false;
}
$ret = dba_insert($key, $blob, $handle);
# Insert failed, check to see if it failed due to an expired key
if (!$ret) {
list($value, $expiry) = $this->decode(dba_fetch($key, $handle));
if ($expiry < time()) {
# Yes expired, delete and try again
dba_delete($key, $handle);
$ret = dba_insert($key, $blob, $handle);
# This time if it failed then it will be handled by the caller like any other race
}
}
dba_close($handle);
wfProfileOut(__METHOD__);
return $ret;
}
示例6: HyperCacheRetranslation_clean
function HyperCacheRetranslation_clean($dbfile)
{
if (!is_file($dbfile)) {
return;
}
$db_con = dba_open($dbfile, "r", "db4");
if (!$db_con) {
events("analyze:: FATAL!!!::{$dbfile}, unable to open");
return null;
}
$mainkey = dba_firstkey($db_con);
$f = array();
$c = 0;
while ($mainkey != false) {
$fetch_content = @dba_fetch($mainkey, $db_con);
$array = @unserialize($fetch_content);
$filepath = $array["TARGET"];
$FullPath = "{$GLOBALS["HyperCacheStoragePath"]}/{$filepath}";
if (!is_file($FullPath)) {
$f[$mainkey] = true;
$mainkey = dba_nextkey($db_con);
continue;
}
$mainkey = dba_nextkey($db_con);
}
@dba_close($db_con);
if (count($f) == 0) {
return;
}
$db_con = dba_open($dbfile, "c", "db4");
if (!$db_con) {
events("analyze:: FATAL!!!::{$dbfile}, unable to open");
return null;
}
while (list($mainkey, $filetype) = each($f)) {
dba_delete($mainkey, $db_con);
}
@dba_close($db_con);
}
示例7: delete
public function delete($key)
{
unset($this->cache[$key]);
return dba_delete($key, $this->dbHandler);
}
示例8: dba_open
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA|
// +----------------------------------------------------------------------+
// | Author: Brent Cook <busterb@mail.utexas.edu> |
// +----------------------------------------------------------------------+
//
// $Id: test_compatibility.php,v 1.2 2003/01/04 11:54:51 mj Exp $
//
// test functionality of the dba compatibility layer
require_once 'DBA/Compatibility.php';
$id = dba_open("file_test", "n", "db3");
if (!$id) {
echo "dba_open failed\n";
exit;
}
dba_insert("key", "This is an example!", $id);
dba_replace("key", "This is another example!", $id);
if (dba_exists("key", $id)) {
echo dba_fetch("key", $id);
dba_delete("key", $id);
}
dba_close($id);
示例9: new_access_token
function new_access_token($token, $consumer)
{
// TODO: check if request token is authorized first
$token = $this->new_token($consumer, 'access');
dba_delete("request_" . $token->key, $this->dbh);
return $token;
}
示例10: removeValues
/**
* Remove values from the database.
*
* @param string $key
*/
public function removeValues(string $key)
{
$key = $this->addNamespaceToKey($key);
$result = dba_delete($key, $this->getHandle());
if (!$result) {
throw new RuntimeException('Remove failed');
}
}
示例11: set
function set($key, $val)
{
$dbh =& $this->_dbh;
if ($this->readonly) {
return;
}
if (dba_exists($key, $dbh)) {
if ($val !== false) {
if (!dba_replace($key, $val, $dbh)) {
return $this->_error("store[replace]({$key})");
}
} else {
if (!dba_delete($key, $dbh)) {
return $this->_error("store[delete]({$key})");
}
}
} else {
if (!dba_insert($key, $val, $dbh)) {
return $this->_error("store[insert]({$key})");
}
}
}
示例12: replace
/**
* Inserts a new value at key. If the key/value pair
* already exist, overwrites the value
*
* @access public
* @param $key string the key to insert
* @param $value string the value to store
* @return object PEAR_Error on failure
*/
function replace($key, $value)
{
if ($this->isWritable()) {
if ($this->_hasReplace) {
return dba_replace($key, $value, $this->_dba);
} else {
$r = true;
if (dba_exists($key, $this->_dba)) {
$r = dba_delete($key, $this->_dba);
}
return $r && dba_insert($key, $value, $this->_dba);
}
} else {
return $this->raiseError(DBA_ERROR_NOT_WRITEABLE);
}
}
示例13: deletePage
function deletePage($pagename)
{
if (dba_exists("" . $pagename, $this->db)) {
$key = dba_fetch("" . $pagename, $this->db);
$keyval = unpack($this->type . '1' . $this->type, $key);
dba_delete("" . $key, $this->db);
dba_delete("" . $pagename, $this->db);
return true;
}
return false;
}
示例14: remove
public function remove($key)
{
$db = dba_open($this->filePath, 'wl', 'db4');
$response = dba_delete($key, $db);
return $response;
}
示例15: STATS_BuildCurrentWeek_move
function STATS_BuildCurrentWeek_move($key, $newkey)
{
$path = "/home/artica/postfix/WEEK";
$dbpath = "{$path}/" . date("YW") . ".db";
$db_con = dba_open($dbpath, "c", "db4");
if (!$db_con) {
echo "DB open {$path} failed\n";
return false;
}
echo "{$key} -> {$newkey}\n";
$data = dba_fetch($key, $db_con);
dba_delete($key, $db_con);
dba_replace($newkey, $data, $db_con);
@dba_close($db_con);
}