Exemplo n.º 1
0
 /**
  * Get entries for project
  *
  * @param $projectId
  * @param $from
  * @param $to
  * @param null $userId
  * @return mixed|string
  */
 public function getEntriesForProject($projectId, $from, $to, $userId = NULL)
 {
     $cacheKey = "harvest_getEntriesForProject_{$projectId}_{$from}_{$to}_{$userId}";
     if (!$this->cache || ($res = $this->cache->getItem($cacheKey)) == false) {
         $url = sprintf('%s/projects/%s/entries?from=%s&to=%s', $this->getApiUrl(), $projectId, $from, $to);
         if (!is_null($userId)) {
             $url .= sprintf('&user_id=%s', $userId);
         }
         $res = $this->doGetRequest($url);
         $this->cache->setItem($cacheKey, $res);
     }
     return $res;
 }
Exemplo n.º 2
0
 /**
  * Expire the cache entry within the equivalent cache key, optionally with arguments.
  * @param  string $name
  * @param  null|array $arguments Must be serializable.
  * @return bool
  */
 public function expire($name, $arguments = null)
 {
     $cacheKey = self::makeCacheKey($name, $arguments);
     return $this->storage->removeItem($cacheKey);
 }