From 448f81362a882a40efaae67337706767651a8cc2 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 30 Sep 2011 10:06:18 -0400
Subject: [PATCH] Make LDAP group name attribute configurable

---
 program/include/rcube_cache.php |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/program/include/rcube_cache.php b/program/include/rcube_cache.php
index a9af8b1..ee94391 100644
--- a/program/include/rcube_cache.php
+++ b/program/include/rcube_cache.php
@@ -28,7 +28,7 @@
  * @package    Cache
  * @author     Thomas Bruederli <roundcube@gmail.com>
  * @author     Aleksander Machniak <alec@alec.pl>
- * @version    1.0
+ * @version    1.1
  */
 class rcube_cache
 {
@@ -184,6 +184,24 @@
 
         // Remove record(s) from the backend
         $this->remove_record($key, $prefix_mode);
+    }
+
+
+    /**
+     * Remove cache records older than ttl
+     */
+    function expunge()
+    {
+        if ($this->type == 'db' && $this->db) {
+            $this->db->query(
+                "DELETE FROM ".get_table_name('cache').
+                " WHERE user_id = ?".
+                " AND cache_key LIKE ?".
+                " AND " . $this->db->unixtimestamp('created')." < ?",
+                $this->userid,
+                $this->prefix.'.%',
+                time() - $this->ttl);
+        }
     }
 
 
@@ -434,7 +452,7 @@
     /**
      * Deletes entry from memcache/apc DB.
      */
-    private function delete_record($index=true)
+    private function delete_record($key, $index=true)
     {
         if ($this->type == 'memcache')
             $this->db->delete($this->ckey($key));

--
Gitblit v1.9.1