Returns the cache policy for this result. If the response has a cache policy,
it is used. Otherwise, any cache policy set on the result itself is used.

@return CachePolicy The cache policy
495842
public function getCachePolicy()
    {
        if (!empty($this->response))
        {
            $policy = $this->response->getCachePolicy();
            if (!empty($policy))
                return $policy;
        }
        return $this->cache_policy;
    }
976181
public function getCache()
    {
        if (!$this->config->getCache()) {
            // This will be removed eventually. The default cache will be instantiated directly in the config class.
            $this->config->setCache(CacheFactory::get($this->config->getCacheType(), $this->config->getCacheOptions()));
        }

        return $this->config->getCache();
    }
801349
public static cachepolicy_cacheglobal_binding[] get(nitro_service service, String policyname) throws Exception{
		cachepolicy_cacheglobal_binding obj = new cachepolicy_cacheglobal_binding();
		obj.set_policyname(policyname);
		cachepolicy_cacheglobal_binding response[] = (cachepolicy_cacheglobal_binding[]) obj.get_resources(service);
		return response;
	}
1342213
public static cachepolicy_csvserver_binding[] get(nitro_service service, String policyname) throws Exception{
		cachepolicy_csvserver_binding obj = new cachepolicy_csvserver_binding();
		obj.set_policyname(policyname);
		cachepolicy_csvserver_binding response[] = (cachepolicy_csvserver_binding[]) obj.get_resources(service);
		return response;
	}
353740
public E retrieve() {
        switch (accessPolicy) {
            case LIFO:
                return deque.pollLast();
            case FIFO:
                return deque.pollFirst();
            default:
                throw new IllegalStateException("Illegal evict policy: " + evictPolicy);
        }
    }
150251
public function getCacheDir()
	{
		if ($this->cacheDir === null) {
			$this->setCacheDir(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR);
		}

		return $this->cacheDir;
	}
885655
protected function computeCacheControlValue()
    {
        if (!$this->cacheControl && !$this->has('ETag') && !$this->has('Last-Modified') && !$this->has('Expires')) {
            return 'no-cache, private';
        }

        if (!$this->cacheControl) {
            // conservative by default
            return 'private, must-revalidate';
        }

        $header = $this->getCacheControlHeader();
        if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) {
            return $header;
        }

        // public if s-maxage is defined, private otherwise
        if (!isset($this->cacheControl['s-maxage'])) {
            return $header.', private';
        }

        return $header;
    }
43565
public function getPolicy()
  {
    $policy = Policy::load($this->getName());
    if ($this->getSeverity() !== NULL) {
      $policy->setSeverity($this->getSeverity());
    }

    foreach ($this->parameters as $param => $value) {
      $info = ['default' => $value];
      $policy->addParameter($param, $info);
    }
    return $policy;
  }
523232
public static cachepolicy_stats[] get(nitro_service service) throws Exception{
		cachepolicy_stats obj = new cachepolicy_stats();
		cachepolicy_stats[] response = (cachepolicy_stats[])obj.stat_resources(service);
		return response;
	}
1106671
public function getResultCacheDriver()
    {
        if ($this->queryCacheProfile && $this->queryCacheProfile->getResultCacheDriver()) {
            return $this->queryCacheProfile->getResultCacheDriver();
        }

        return $this->em->getConfiguration()->getResultCacheImpl();
    }
1157381
public function getRoles() {
		if ( $this->cacheEnabled() ) {
			if ( is_null( $this->getCachedRoles() ) ) {
				Cache::remember( 'roles.user_' . $this->id, config( 'roles.cache.expiry' ), function () {
					return $this->roles()->get();
				} );
			}

			return $this->getCachedRoles();
		} else {
			return $this->roles()->get();
		}
	}
1010962
public static lbvserver_cachepolicy_binding[] get(nitro_service service, String name) throws Exception{
		lbvserver_cachepolicy_binding obj = new lbvserver_cachepolicy_binding();
		obj.set_name(name);
		lbvserver_cachepolicy_binding response[] = (lbvserver_cachepolicy_binding[]) obj.get_resources(service);
		return response;
	}
225412
public function getPolicy($name)
    {
        if (isset($this->policies[$name])) {
            return $this->policies[$name];
        }

        return null;
    }
1317846
private function getCacheContent($policy, $cache, &$data) {
        $policyContent = $this->tryReadFile($policy);
        $cacheContent = $this->tryReadFile($cache);
        $data = null;

        if ($policyContent === false || $cacheContent === false) {
            $this->tryDeleteFile($policy);
            $this->tryDeleteFile($cache);
            return false;
        }

        $policyEntry = json_decode($policyContent, true);

        $absoluteExpiration = (int)$policyEntry['absoluteExpiration'];

        if ($absoluteExpiration != 0 && $absoluteExpiration < time()) {
            $this->tryDeleteFile($policy);
            $this->tryDeleteFile($cache);
            return false;
        }

        $data = unserialize($cacheContent);

        return true;
    }
814018
public static cachepolicy[] get(nitro_service service) throws Exception{
		cachepolicy obj = new cachepolicy();
		cachepolicy[] response = (cachepolicy[])obj.get_resources(service);
		return response;
	}
474486
public function getCallbackResultFromCache()
    {
        // get cache key
        $cacheKey = $this->getCacheKey();

        // check if cached
        try {
            $cache = $this->cache($this->requestBag->getApiConfig()->get('Cache'));

            return $cache->read($cacheKey);
        } catch (\Exception $e) {
            throw new RestException('Unable to read the cache. ' . $e->getMessage());
        }
    }
1073778
static Policy getPolicy() {
        final SecurityManager sm = System.getSecurityManager();

        if (sm != null) {
            return AccessController.doPrivileged(new PrivilegedAction<Policy>() {
                public Policy run() {
                    return Policy.getPolicy();
                }
            });
        } else {
            return Policy.getPolicy();
        }
    }