/**
  * Creates a new cache storage for a given location through eZ Publish cluster mechanism
  * Options can contain the 'ttl' ( Time-To-Life ). This is per default set
  * to 1 day.
  *
  * @param string $location Path to the cache location inside the cluster
  * @param array(string=>string) $options Options for the cache.
  */
 public function __construct($location, $options = array())
 {
     $path = eZSys::cacheDirectory() . '/rest/' . $location;
     if (!file_exists($path)) {
         if (!eZDir::mkdir($path, false, true)) {
             throw new ezcBaseFilePermissionException($path, ezcBaseFileException::WRITE, 'Cache location is not writeable.');
         }
     }
     parent::__construct($path);
     $this->properties['options'] = new ezpCacheStorageClusterOptions($options);
 }
Exemple #2
0
    /**
     * Creates a new cache storage for a given location through eZ Publish cluster mechanism
     * Options can contain the 'ttl' ( Time-To-Life ). This is per default set
     * to 1 day.
     * @param string $location Path to the cache location inside the cluster
     * @param array(string=>string) $options Options for the cache.
     */
    public function __construct( $location, $options = array() )
    {
        $apiName = ezpRestPrefixFilterInterface::getApiProviderName();
        $apiVersion = ezpRestPrefixFilterInterface::getApiVersion();
        $location = eZSys::cacheDirectory().'/rest/'.$location;
        if( !file_exists( $location ) )
        {
            if( !eZDir::mkdir( $location, false, true ) )
            {
                throw new ezcBaseFilePermissionException(
                    $location,
                    ezcBaseFileException::WRITE,
                    'Cache location is not writeable.'
                );
            }
        }

        parent::__construct( $location );
        $this->properties['options'] = new ezpCacheStorageClusterOptions( $options );
    }