Changeset 330

Show
Ignore:
Timestamp:
03/15/08 20:34:30 (5 years ago)
Author:
d0nut
Message:

first caching approaches for tagger

Location:
taggingreloaded
Files:
4 added
2 modified

Legend:

Unmodified
Added
Removed
  • taggingreloaded/files/lib/page/TaggingPage.class.php

    r172 r330  
    3434                 
    3535                if(empty($this->tag)) { 
    36                         // order by weight and cut 
    37                         $sql = "SELECT          tag, 
    38                                                 SUM(weight) AS weight 
    39                                 FROM            wcf".WCF_N."_taggingreloaded wcf 
    40                                 GROUP BY        tag 
    41                                 ORDER BY        weight DESC 
    42                                 LIMIT           200"; 
    43                         //      SUM( weight ) * IF(COUNT(tag), 1.2, 1 ) 
     36                        $minLifetime = 0; 
     37                        $maxLifetime = 43200; // 12h 
    4438 
    45                         // order by tag 
    46                         $sql = "SELECT tag,weight FROM ($sql) A ORDER BY tag ASC"; 
     39                        WCF::getCache()->addResource( 
     40                                'taggingreloaded.wcf.taggingpage',  
     41                                WCF_DIR.'cache/cache.taggingreloaded.wcf.taggingpage.php', 
     42                                WCF_DIR.'lib/system/cache/CacheBuilderTaggingReloadedTagging.class.php', 
     43                                $minLifetime, 
     44                                $maxLifetime 
     45                        ); 
    4746                         
    48                         // query 
    49                         $result = WCF::getDB()->sendQuery($sql); 
    50                         while ($row = WCF::getDB()->fetchArray($result)) { 
    51                                 $this->tags[$row['tag']] = array( 
    52                                                 'weight'=> $row['weight'], 
    53                                                 'color'=> 0, 
    54                                                 'size'=> 0, 
    55                                                 'url' => $this->rewriter->publicParseTagURLs($row['tag']) 
    56                                         ); 
    57                         } 
    58                          
     47                        $this->tags = WCF::getCache()->get('taggingreloaded.wcf.taggingpage'); 
    5948                        $this->tags = TaggingReloadedUtil::beautify($this->tags); 
    6049                } 
  • taggingreloaded/optionals/de.easy-coding.wbb.taggingreloaded/files/lib/system/event/listener/TaggingReloadedWBBPageListener.class.php

    r178 r330  
    77require_once(WCF_DIR.'lib/util/TaggingReloadedUtil.class.php'); 
    88require_once(WCF_DIR.'lib/system/event/listener/TaggingReloadedPageListener.class.php'); 
    9 require_once(WBB_DIR.'lib/data/board/BoardListTaggingReloaded.class.php'); 
    109 
    1110// seo imports 
     
    4948         
    5049        /** 
    51          * reads by board 
    52          */ 
    53         protected function queryTagsByBoard() { 
    54                 // order by weight and cut 
    55                 $sql = "SELECT          tag, 
    56                                         SUM(weight) AS weight 
    57                         FROM            wcf".WCF_N."_taggingreloaded wcf 
    58                         NATURAL JOIN    wbb".WBB_N."_taggingreloaded wbb 
    59                         JOIN            wbb".WBB_N."_post p 
    60                         ON              wbb.postID = p.postID 
    61                         JOIN            wbb".WBB_N."_thread t 
    62                         ON              p.threadID = t.threadID 
    63                         WHERE           t.boardID IN (".implode(',', $this->boards).") 
    64                         GROUP BY        tag 
    65                         ORDER BY        weight DESC 
    66                         LIMIT           50"; 
    67  
    68                 return $sql; 
    69         } 
    70          
    71         /** 
    7250         * reads (threaddata) by post 
    7351         */ 
     
    145123                                break; 
    146124                        case 'BoardPage': 
    147                                 $boardID = $this->eventObj->boardID; 
    148                                 $boardList = new BoardListTaggingReloaded($boardID); 
    149                                 $boardList->renderBoards(); 
    150                                 $this->readSubBoards($boardList->getSubBoards()); 
    151                                 $this->boards[] = $boardID; 
    152                                  
    153                                 $sql = $this->queryTagsByBoard(); 
     125                                $minLifetime = 0; 
     126                                $maxLifetime = 43200; //12 h 
     127 
     128                                WCF::getCache()->addResource( 
     129                                        'taggingreloaded.wbb.boards',  
     130                                        WCF_DIR.'cache/cache.taggingreloaded.wbb.boards.php', 
     131                                        WCF_DIR.'lib/system/cache/CacheBuilderTaggingReloadedBoards.class.php', 
     132                                        $minLifetime, 
     133                                        $maxLifetime 
     134                                ); 
    154135                                break; 
    155136                        case 'TaggingPage':