当前位置: 首页>>代码示例>>PHP>>正文


PHP Memcached_DataObject::cachedQuery方法代码示例

本文整理汇总了PHP中Memcached_DataObject::cachedQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Memcached_DataObject::cachedQuery方法的具体用法?PHP Memcached_DataObject::cachedQuery怎么用?PHP Memcached_DataObject::cachedQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Memcached_DataObject的用法示例。


在下文中一共展示了Memcached_DataObject::cachedQuery方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getProfiles

 function getProfiles()
 {
     $featured_nicks = common_config('nickname', 'featured');
     if (!$featured_nicks) {
         return null;
     }
     $quoted = array();
     foreach ($featured_nicks as $nick) {
         $quoted[] = "'{$nick}'";
     }
     $table = "user";
     if (common_config('db', 'quote_identifiers')) {
         $table = '"' . $table . '"';
     }
     $qry = 'SELECT profile.* ' . 'FROM profile JOIN ' . $table . ' on profile.id = ' . $table . '.id ' . 'WHERE ' . $table . '.nickname in (' . implode(',', $quoted) . ') ' . 'ORDER BY profile.created DESC ';
     $limit = PROFILES_PER_SECTION + 1;
     $offset = 0;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $profile = Memcached_DataObject::cachedQuery('Profile', $qry, 6 * 3600);
     return $profile;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:25,代码来源:featureduserssection.php

示例2: getNotices

 function getNotices()
 {
     // @fixme there should be a common func for this
     if (common_config('db', 'type') == 'pgsql') {
         if (!empty($this->out->tag)) {
             $tag = pg_escape_string($this->out->tag);
         }
     } else {
         if (!empty($this->out->tag)) {
             $tag = mysql_escape_string($this->out->tag);
         }
     }
     $weightexpr = common_sql_weight('fave.modified', common_config('popular', 'dropoff'));
     $cutoff = sprintf("fave.modified > '%s'", common_sql_date(time() - common_config('popular', 'cutoff')));
     $qry = "SELECT notice.*, {$weightexpr} as weight ";
     if (isset($tag)) {
         $qry .= 'FROM notice_tag, notice JOIN fave ON notice.id = fave.notice_id ' . "WHERE {$cutoff} and notice.id = notice_tag.notice_id and '{$tag}' = notice_tag.tag";
     } else {
         $qry .= 'FROM notice JOIN fave ON notice.id = fave.notice_id ' . "WHERE {$cutoff}";
     }
     $qry .= ' GROUP BY notice.id,notice.profile_id,notice.content,notice.uri,' . 'notice.rendered,notice.url,notice.created,notice.modified,' . 'notice.reply_to,notice.is_local,notice.source,notice.conversation, ' . 'notice.lat,notice.lon,location_id,location_ns,notice.repeat_of' . ' ORDER BY weight DESC';
     $offset = 0;
     $limit = NOTICES_PER_SECTION + 1;
     $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     $notice = Memcached_DataObject::cachedQuery('Notice', $qry, 1200);
     return $notice;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:27,代码来源:popularnoticesection.php

示例3: getAttachments

 /**
  * Get the attachments for a particlar notice.
  *
  * @param int $post_id
  * @return array of File objects
  */
 static function getAttachments($post_id)
 {
     $file = new File();
     $query = "select file.* from file join file_to_post on (file_id = file.id) where post_id = " . $file->escape($post_id);
     $file = Memcached_DataObject::cachedQuery('File', $query);
     $att = array();
     while ($file->fetch()) {
         $att[] = clone $file;
     }
     return $att;
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:17,代码来源:File.php

示例4: getGroups

 function getGroups()
 {
     $qry = 'SELECT user_group.*, count(*) as value ' . 'FROM user_group JOIN group_member ' . 'ON user_group.id = group_member.group_id ' . 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' . 'ORDER BY value DESC ';
     $limit = GROUPS_PER_SECTION;
     $offset = 0;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $group = Memcached_DataObject::cachedQuery('User_group', $qry, 3600);
     return $group;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:13,代码来源:groupsbymemberssection.php

示例5: getProfiles

 function getProfiles()
 {
     $qry = 'SELECT profile.*, count(*) as value ' . 'FROM profile JOIN notice ON profile.id = notice.profile_id ' . (common_config('public', 'localonly') ? 'WHERE is_local = 1 ' : '') . 'GROUP BY profile.id,nickname,fullname,profileurl,homepage,bio,location,profile.created,profile.modified,textsearch ' . 'ORDER BY value DESC ';
     $limit = PROFILES_PER_SECTION;
     $offset = 0;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $profile = Memcached_DataObject::cachedQuery('Profile', $qry, 6 * 3600);
     return $profile;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:13,代码来源:topposterssection.php

示例6: getTags

 function getTags()
 {
     $qry = $this->query();
     $limit = TAGS_PER_SECTION;
     $offset = 0;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $profile_tag = Memcached_DataObject::cachedQuery('Profile_tag', sprintf($qry, $this->out->user->id));
     return $profile_tag;
 }
开发者ID:himmelex,项目名称:NTW,代码行数:13,代码来源:subpeopletagcloudsection.php

示例7: getPeopletags

 function getPeopletags()
 {
     $qry = 'SELECT profile_list.*, subscriber_count as value ' . 'FROM profile_list WHERE profile_list.private = false ' . 'ORDER BY value DESC ';
     $limit = PEOPLETAGS_PER_SECTION;
     $offset = 0;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $peopletag = Memcached_DataObject::cachedQuery('Profile_list', $qry, 3600);
     return $peopletag;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:13,代码来源:peopletagsbysubssection.php

示例8: getTags

 function getTags()
 {
     $weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
     // @fixme should we use the cutoff too? Doesn't help with indexing per-user.
     $qry = 'SELECT notice_tag.tag, ' . $weightexpr . ' as weight ' . 'FROM notice_tag JOIN notice ' . 'ON notice_tag.notice_id = notice.id ' . 'WHERE notice.profile_id = %d ' . 'GROUP BY notice_tag.tag ' . 'ORDER BY weight DESC ';
     $limit = TAGS_PER_SECTION;
     $offset = 0;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $tag = Memcached_DataObject::cachedQuery('Notice_tag', sprintf($qry, $this->user->id), 3600);
     return $tag;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:15,代码来源:personaltagcloudsection.php

示例9: getNotices

 function getNotices()
 {
     if (common_config('db', 'type') == 'pgsql') {
         $weightexpr = 'sum(exp(-extract(epoch from (now() - fave.modified)) / %s))';
     } else {
         $weightexpr = 'sum(exp(-(now() - fave.modified) / %s))';
     }
     $qry = 'SELECT notice.*, ' . $weightexpr . ' as weight ' . 'FROM notice JOIN fave ON notice.id = fave.notice_id ' . 'GROUP BY notice.id,notice.profile_id,notice.content,notice.uri,' . 'notice.rendered,notice.url,notice.created,notice.modified,' . 'notice.reply_to,notice.is_local,notice.source ' . 'ORDER BY weight DESC';
     $offset = 0;
     $limit = NOTICES_PER_SECTION + 1;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $notice = Memcached_DataObject::cachedQuery('Notice', sprintf($qry, common_config('popular', 'dropoff')), 1200);
     return $notice;
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:18,代码来源:popularnoticesection.php

示例10: getTags

 function getTags()
 {
     if (common_config('db', 'type') == 'pgsql') {
         $weightexpr = 'sum(exp(-extract(epoch from (now() - notice_tag.created)) / %s))';
     } else {
         $weightexpr = 'sum(exp(-(now() - notice_tag.created) / %s))';
     }
     $qry = 'SELECT notice_tag.tag, ' . $weightexpr . ' as weight ' . 'FROM notice_tag JOIN notice ' . 'ON notice_tag.notice_id = notice.id ' . 'JOIN group_inbox on group_inbox.notice_id = notice.id ' . 'WHERE group_inbox.group_id = %d ' . 'GROUP BY notice_tag.tag ' . 'ORDER BY weight DESC ';
     $limit = TAGS_PER_SECTION;
     $offset = 0;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $tag = Memcached_DataObject::cachedQuery('Notice_tag', sprintf($qry, common_config('tag', 'dropoff'), $this->group->id), 3600);
     return $tag;
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:18,代码来源:grouptagcloudsection.php

示例11: showContent

 /**
  * Content area
  *
  * Shows the list of popular notices
  *
  * @return void
  */
 function showContent()
 {
     $groupId = intval($this->group->id);
     $weightexpr = common_sql_weight('fave.modified', common_config('popular', 'dropoff'));
     $cutoff = sprintf("fave.modified > '%s'", common_sql_date(time() - common_config('popular', 'cutoff')));
     $qry = 'SELECT notice.*, ' . $weightexpr . ' as weight ' . 'FROM notice ' . "JOIN group_inbox ON notice.id = group_inbox.notice_id " . 'JOIN fave ON notice.id = fave.notice_id ' . "WHERE {$cutoff} AND group_id = {$groupId} " . 'GROUP BY id,profile_id,uri,content,rendered,url,created,notice.modified,reply_to,is_local,source,notice.conversation ' . 'ORDER BY weight DESC';
     $offset = ($this->page - 1) * NOTICES_PER_PAGE;
     $limit = NOTICES_PER_PAGE + 1;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $notice = Memcached_DataObject::cachedQuery('Notice', $qry, 600);
     $nl = new NoticeList($notice, $this);
     $cnt = $nl->show();
     if ($cnt == 0) {
         //$this->showEmptyList();
     }
     $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, $this->page, 'groupfavorited', array('nickname' => $this->group->nickname));
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:28,代码来源:groupfavoritedaction.php

示例12: getTags

 function getTags()
 {
     $weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
     // @fixme should we use the cutoff too? Doesn't help with indexing per-group.
     $names = $this->group->getAliases();
     $names = array_merge(array($this->group->nickname), $names);
     // XXX This is dumb.
     $quoted = array();
     foreach ($names as $name) {
         $quoted[] = "'{$name}'";
     }
     $namestring = implode(',', $quoted);
     $qry = 'SELECT notice_tag.tag, ' . $weightexpr . ' as weight ' . 'FROM notice_tag JOIN notice ' . 'ON notice_tag.notice_id = notice.id ' . 'JOIN group_inbox on group_inbox.notice_id = notice.id ' . 'WHERE group_inbox.group_id = %d ' . 'AND notice_tag.tag not in (%s) ' . 'GROUP BY notice_tag.tag ' . 'ORDER BY weight DESC ';
     $limit = TAGS_PER_SECTION;
     $offset = 0;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $tag = Memcached_DataObject::cachedQuery('Notice_tag', sprintf($qry, $this->group->id, $namestring), 3600);
     return $tag;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:23,代码来源:grouptagcloudsection.php

示例13: showContent

 /**
  * Content area
  *
  * Shows the list of popular notices
  *
  * @return void
  */
 function showContent()
 {
     if (common_config('db', 'type') == 'pgsql') {
         $weightexpr = 'sum(exp(-extract(epoch from (now() - fave.modified)) / %s))';
     } else {
         $weightexpr = 'sum(exp(-(now() - fave.modified) / %s))';
     }
     $qry = 'SELECT notice.*, ' . $weightexpr . ' as weight ' . 'FROM notice JOIN fave ON notice.id = fave.notice_id ' . 'GROUP BY id,profile_id,uri,content,rendered,url,created,notice.modified,reply_to,is_local,source ' . 'ORDER BY weight DESC';
     $offset = ($this->page - 1) * NOTICES_PER_PAGE;
     $limit = NOTICES_PER_PAGE + 1;
     if (common_config('db', 'type') == 'pgsql') {
         $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     } else {
         $qry .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     $notice = Memcached_DataObject::cachedQuery('Notice', sprintf($qry, common_config('popular', 'dropoff')), 600);
     $nl = new NoticeList($notice, $this);
     $cnt = $nl->show();
     $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, $this->page, 'favorited');
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:27,代码来源:favorited.php


注:本文中的Memcached_DataObject::cachedQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。