Changeset 5278 in subversion


Ignore:
Timestamp:
Sep 26, 2011 2:28:01 AM (20 months ago)
Author:
thomasb
Message:

Add method to remove outdated cache entries from sql DB

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_cache.php

    r4909 r5278  
    2929 * @author     Thomas Bruederli <roundcube@gmail.com> 
    3030 * @author     Aleksander Machniak <alec@alec.pl> 
    31  * @version    1.0 
     31 * @version    1.1 
    3232 */ 
    3333class rcube_cache 
     
    189189 
    190190    /** 
     191     * Remove cache records older than ttl 
     192     */ 
     193    function expunge() 
     194    { 
     195        if ($this->type == 'db' && $this->db) { 
     196            $this->db->query( 
     197                "DELETE FROM ".get_table_name('cache'). 
     198                " WHERE user_id = ?". 
     199                " AND cache_key LIKE ?". 
     200                " AND " . $this->db->unixtimestamp('created')." < ?", 
     201                $this->userid, 
     202                $this->prefix.'.%', 
     203                time() - $this->ttl); 
     204        } 
     205    } 
     206 
     207 
     208    /** 
    191209     * Writes the cache back to the DB. 
    192210     */ 
Note: See TracChangeset for help on using the changeset viewer.