X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2FNotice_tag.php;h=94f9296d602c92cc1c121cd498ad988ce4b6024d;hb=88891f8ebdad47629e64a103c68a0cf0b6bf3079;hp=0dc862bf3117f0eb04518814e8823b090bbc5484;hpb=5d84485001ace75c49cdc295b4ed3540db83e988;p=quix0rs-gnu-social.git diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php index 0dc862bf31..94f9296d60 100644 --- a/classes/Notice_tag.php +++ b/classes/Notice_tag.php @@ -1,10 +1,25 @@ . */ -require_once 'DB/DataObject.php'; -class Notice_tag extends DB_DataObject +require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; + +class Notice_tag extends Memcached_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -15,8 +30,28 @@ class Notice_tag extends DB_DataObject public $created; // datetime() not_null /* Static get */ - function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Notice_tag',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Notice_tag',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE + + static function getStream($tag, $offset=0, $limit=20) { + $qry = + 'SELECT notice.* ' . + 'FROM notice JOIN notice_tag ON notice.id = notice_tag.notice_id ' . + 'WHERE notice_tag.tag = "%s" '; + + return Notice::getStream(sprintf($qry, $tag), + 'notice_tag:notice_stream:' . common_keyize($tag), + $offset, $limit); + } + + function blowCache() + { + $cache = common_memcache(); + if ($cache) { + $cache->delete(common_cache_key('notice_tag:notice_stream:' . $this->tag)); + } + } }