本文整理汇总了PHP中ccache_find函数的典型用法代码示例。如果您正苦于以下问题:PHP ccache_find函数的具体用法?PHP ccache_find怎么用?PHP ccache_find使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ccache_find函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: feedlist_init_cat
private function feedlist_init_cat($cat_id, $hidden = false)
{
$obj = array();
$cat_id = (int) $cat_id;
if ($cat_id > 0) {
$cat_unread = ccache_find($this->link, $cat_id, $_SESSION["uid"], true);
} else {
if ($cat_id == 0 || $cat_id == -2) {
$cat_unread = getCategoryUnread($this->link, $cat_id);
}
}
$obj['id'] = 'CAT:' . $cat_id;
$obj['items'] = array();
$obj['name'] = getCategoryTitle($this->link, $cat_id);
$obj['type'] = 'feed';
$obj['unread'] = (int) $cat_unread;
$obj['hidden'] = $hidden;
$obj['bare_id'] = $cat_id;
return $obj;
}
示例2: getCategoryCounters
function getCategoryCounters()
{
$ret_arr = array();
/* Labels category */
$cv = array("id" => -2, "kind" => "cat", "counter" => getCategoryUnread(-2));
array_push($ret_arr, $cv);
$result = db_query("SELECT id AS cat_id, value AS unread,\n\t\t\t(SELECT COUNT(id) FROM ttrss_feed_categories AS c2\n\t\t\t\tWHERE c2.parent_cat = ttrss_feed_categories.id) AS num_children\n\t\t\tFROM ttrss_feed_categories, ttrss_cat_counters_cache\n\t\t\tWHERE ttrss_cat_counters_cache.feed_id = id AND\n\t\t\tttrss_cat_counters_cache.owner_uid = ttrss_feed_categories.owner_uid AND\n\t\t\tttrss_feed_categories.owner_uid = " . $_SESSION["uid"]);
while ($line = db_fetch_assoc($result)) {
$line["cat_id"] = (int) $line["cat_id"];
if ($line["num_children"] > 0) {
$child_counter = getCategoryChildrenUnread($line["cat_id"], $_SESSION["uid"]);
} else {
$child_counter = 0;
}
$cv = array("id" => $line["cat_id"], "kind" => "cat", "counter" => $line["unread"] + $child_counter);
array_push($ret_arr, $cv);
}
/* Special case: NULL category doesn't actually exist in the DB */
$cv = array("id" => 0, "kind" => "cat", "counter" => (int) ccache_find(0, $_SESSION["uid"], true));
array_push($ret_arr, $cv);
return $ret_arr;
}
示例3: ccache_update
function ccache_update($link, $feed_id, $owner_uid, $is_cat = false, $update_pcat = true)
{
if (!is_numeric($feed_id)) {
return;
}
if (!$is_cat && $feed_id > 0) {
$tmp_result = db_query($link, "SELECT owner_uid FROM ttrss_feeds \n\t\t\t\tWHERE id = '{$feed_id}'");
$owner_uid = db_fetch_result($tmp_result, 0, "owner_uid");
}
$prev_unread = ccache_find($link, $feed_id, $owner_uid, $is_cat, true);
/* When updating a label, all we need to do is recalculate feed counters
* because labels are not cached */
if ($feed_id < 0) {
ccache_update_all($link, $owner_uid);
return;
}
if (!$is_cat) {
$table = "ttrss_counters_cache";
} else {
$table = "ttrss_cat_counters_cache";
}
if ($is_cat && $feed_id >= 0) {
if ($feed_id != 0) {
$cat_qpart = "cat_id = '{$feed_id}'";
} else {
$cat_qpart = "cat_id IS NULL";
}
/* Recalculate counters for child feeds */
$result = db_query($link, "SELECT id FROM ttrss_feeds\n\t\t\t\t\t\tWHERE owner_uid = '{$owner_uid}' AND {$cat_qpart}");
while ($line = db_fetch_assoc($result)) {
ccache_update($link, $line["id"], $owner_uid, false, false);
}
$result = db_query($link, "SELECT SUM(value) AS sv \n\t\t\t\tFROM ttrss_counters_cache, ttrss_feeds \n\t\t\t\tWHERE id = feed_id AND {$cat_qpart} AND \n\t\t\t\tttrss_feeds.owner_uid = '{$owner_uid}'");
$unread = (int) db_fetch_result($result, 0, "sv");
} else {
$unread = (int) getFeedArticles($link, $feed_id, $is_cat, true, $owner_uid);
}
db_query($link, "BEGIN");
$result = db_query($link, "SELECT feed_id FROM {$table}\n\t\t\tWHERE owner_uid = '{$owner_uid}' AND feed_id = '{$feed_id}' LIMIT 1");
if (db_num_rows($result) == 1) {
db_query($link, "UPDATE {$table} SET\n\t\t\t\tvalue = '{$unread}', updated = NOW() WHERE\n\t\t\t\tfeed_id = '{$feed_id}' AND owner_uid = '{$owner_uid}'");
} else {
db_query($link, "INSERT INTO {$table}\n\t\t\t\t(feed_id, value, owner_uid, updated) \n\t\t\t\tVALUES \n\t\t\t\t({$feed_id}, {$unread}, {$owner_uid}, NOW())");
}
db_query($link, "COMMIT");
if ($feed_id > 0 && $prev_unread != $unread) {
if (!$is_cat) {
/* Update parent category */
if ($update_pcat) {
$result = db_query($link, "SELECT cat_id FROM ttrss_feeds\n\t\t\t\t\t\tWHERE owner_uid = '{$owner_uid}' AND id = '{$feed_id}'");
$cat_id = (int) db_fetch_result($result, 0, "cat_id");
ccache_update($link, $cat_id, $owner_uid, true);
}
}
} else {
if ($feed_id < 0) {
ccache_update_all($link, $owner_uid);
}
}
return $unread;
}
示例4: outputHeadlinesList
$override_order = "updated DESC";
break;
case "score":
$override_order = "score DESC";
break;
}
$ret = outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, $vgroup_last_feed, $override_order);
$topmost_article_ids = $ret[0];
$headlines_count = $ret[1];
$returned_feed = $ret[2];
$disable_cache = $ret[3];
$vgroup_last_feed = $ret[4];
print "]]></headlines>";
print "<headlines-count value=\"{$headlines_count}\"/>";
print "<vgroup-last-feed value=\"{$vgroup_last_feed}\"/>";
$headlines_unread = ccache_find($link, $returned_feed, $_SESSION["uid"], $cat_view, true);
if ($headlines_unread == -1) {
$headlines_unread = getFeedUnread($link, $returned_feed, $cat_view);
}
print "<headlines-unread value=\"{$headlines_unread}\"/>";
printf("<disable-cache value=\"%d\"/>", $disable_cache);
if ($_REQUEST["debug"]) {
$timing_info = print_checkpoint("10", $timing_info);
}
if (is_array($topmost_article_ids) && !get_pref($link, 'COMBINED_DISPLAY_MODE') && !$_SESSION["bw_limit"]) {
print "<articles>";
foreach ($topmost_article_ids as $id) {
outputArticleXML($link, $id, $feed, false);
}
print "</articles>";
}