Skip to content

Commit

Permalink
[mms] The Hashtable cache driver now allows the lifetime of the messa…
Browse files Browse the repository at this point in the history
…ge data to be specified.
  • Loading branch information
slusarz committed Mar 6, 2014
1 parent c1ad865 commit c60830f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions framework/Imap_Client/doc/Horde/Imap/Client/UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ Upgrading to 2.19.0

Added the 'force_map' parameter.

- Horde_Imap_Client_Cache_Backend_Hashtable

- Constructor

Added the 'lifetime' configuration parameter.


Upgrading to 2.18.0
===================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ class Horde_Imap_Client_Cache_Backend_Hashtable
* <pre>
* - REQUIRED parameters:
* - hashtable: (Horde_HashTable) A HashTable object.
*
* - Optional Parameters:
* - lifetime: (integer) The lifetime of the cache data (in seconds).
* DEFAULT: 604800 seconds (1 week) [@since 2.19.0]
* </pre>
*/
public function __construct(array $params = array())
Expand All @@ -85,6 +89,10 @@ public function __construct(array $params = array())
throw new InvalidArgumentException('Missing hashtable parameter.');
}

$params = array_merge(array(
'lifetime' => 604800
));

parent::__construct($params);
}

Expand Down Expand Up @@ -267,7 +275,11 @@ public function save()
$ptr = &$this->_data[$mbox];
foreach ($this->_getMsgCids($mbox, array_keys($val['u'])) as $k2 => $v2) {
try {
$this->_hash->set($v2, $this->_pack->pack($ptr[$k2]));
$this->_hash->set(
$v2,
$this->_pack->pack($ptr[$k2]),
array('expire' => $this->_params['lifetime'])
);
} catch (Horde_Pack_Exception $e) {
$this->deleteMsgs($mbox, array($v2));
$val['d'][] = $v2;
Expand Down
2 changes: 2 additions & 0 deletions framework/Imap_Client/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] The Hashtable cache driver now allows the lifetime of the message data to be specified.
* [mms] Fix removing UID from cached list in Hashtable cache driver if the message data no longer exists.
* [mms] Add &apos;force_map&apos; option to Horde_Imap_Client_Base#copy() to guarantee that the mapping array is always returned.
* [mms] More accurate way of determining appended UID on append when UIDPLUS is not available.
Expand Down Expand Up @@ -2284,6 +2285,7 @@
<date>2014-03-05</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] The Hashtable cache driver now allows the lifetime of the message data to be specified.
* [mms] Fix removing UID from cached list in Hashtable cache driver if the message data no longer exists.
* [mms] Add &apos;force_map&apos; option to Horde_Imap_Client_Base#copy() to guarantee that the mapping array is always returned.
* [mms] More accurate way of determining appended UID on append when UIDPLUS is not available.
Expand Down

0 comments on commit c60830f

Please sign in to comment.