* Calendar/eSync: fixed caching causing new events on EGroupware side not to appear on device (withing time of a running ping-request)

This commit is contained in:
Ralf Becker 2014-01-28 16:27:01 +00:00
parent 8147adcb95
commit a8e8f33ff4

View File

@ -317,6 +317,11 @@ class calendar_so
return $events;
}
/**
* Maximum time a ctag get cached, as ActiveSync ping requests can run for a long time
*/
const MAX_CTAG_CACHE_TIME = 300;
/**
* Get maximum modification time of events for given participants and optional owned by them
*
@ -330,6 +335,12 @@ class calendar_so
function get_ctag($users, $owner_too=false,$master_only=false)
{
static $ctags = array(); // some per-request caching
static $last_request = null;
if (!isset($last_request) || time()-$last_request > self::MAX_CTAG_CACHE_TIME)
{
$ctags = array();
$last_request = time();
}
$signature = serialize(func_get_args());
if (isset($ctags[$signature])) return $ctags[$signature];