ArangoDB-PHP API Documentation
  • Namespace
  • Class
  • Deprecated

Namespaces

  • triagens
    • ArangoDb

Classes

  • triagens\ArangoDb\AdminHandler
  • triagens\ArangoDb\AqlUserFunction
  • triagens\ArangoDb\Autoloader
  • triagens\ArangoDb\Batch
  • triagens\ArangoDb\BatchPart
  • triagens\ArangoDb\BindVars
  • triagens\ArangoDb\Collection
  • triagens\ArangoDb\CollectionHandler
  • triagens\ArangoDb\Connection
  • triagens\ArangoDb\ConnectionOptions
  • triagens\ArangoDb\Cursor
  • triagens\ArangoDb\Database
  • triagens\ArangoDb\DefaultValues
  • triagens\ArangoDb\Document
  • triagens\ArangoDb\DocumentHandler
  • triagens\ArangoDb\Edge
  • triagens\ArangoDb\EdgeDefinition
  • triagens\ArangoDb\EdgeHandler
  • triagens\ArangoDb\Endpoint
  • triagens\ArangoDb\Export
  • triagens\ArangoDb\ExportCursor
  • triagens\ArangoDb\Graph
  • triagens\ArangoDb\GraphHandler
  • triagens\ArangoDb\Handler
  • triagens\ArangoDb\HttpHelper
  • triagens\ArangoDb\HttpResponse
  • triagens\ArangoDb\QueryCacheHandler
  • triagens\ArangoDb\QueryHandler
  • triagens\ArangoDb\Statement
  • triagens\ArangoDb\TraceRequest
  • triagens\ArangoDb\TraceResponse
  • triagens\ArangoDb\Transaction
  • triagens\ArangoDb\Traversal
  • triagens\ArangoDb\UpdatePolicy
  • triagens\ArangoDb\UrlHelper
  • triagens\ArangoDb\Urls
  • triagens\ArangoDb\User
  • triagens\ArangoDb\UserHandler
  • triagens\ArangoDb\ValueValidator
  • triagens\ArangoDb\Vertex
  • triagens\ArangoDb\VertexHandler

Exceptions

  • triagens\ArangoDb\ClientException
  • triagens\ArangoDb\ConnectException
  • triagens\ArangoDb\Exception
  • triagens\ArangoDb\ServerException
  1 <?php
  2 
  3 /**
  4  * ArangoDB PHP client: AQL query result cache handling
  5  *
  6  * @package   triagens\ArangoDb
  7  * @author    Jan Steemann
  8  * @copyright Copyright 2015, triagens GmbH, Cologne, Germany
  9  */
 10 
 11 namespace triagens\ArangoDb;
 12 
 13 class QueryCacheHandler extends
 14     Handler
 15 {
 16 
 17     /**
 18      * Globally turns on the AQL query result cache
 19      *
 20      * @throws Exception
 21      */
 22     public function enable()
 23     {
 24         $url = UrlHelper::buildUrl(Urls::URL_QUERY_CACHE, ['properties']);
 25         $this->getConnection()->put($url, $this->json_encode_wrapper(['mode' => 'on']));
 26     }
 27 
 28 
 29     /**
 30      * Globally turns off the AQL query result cache
 31      *
 32      * @throws Exception
 33      */
 34     public function disable()
 35     {
 36         $url = UrlHelper::buildUrl(Urls::URL_QUERY_CACHE, ['properties']);
 37         $this->getConnection()->put($url, $this->json_encode_wrapper(['mode' => 'off']));
 38     }
 39 
 40 
 41     /**
 42      * Globally sets the AQL query result cache to demand mode
 43      *
 44      * @throws Exception
 45      */
 46     public function enableDemandMode()
 47     {
 48         $url = UrlHelper::buildUrl(Urls::URL_QUERY_CACHE, ['properties']);
 49         $this->getConnection()->put($url, $this->json_encode_wrapper(['mode' => 'demand']));
 50     }
 51 
 52     /**
 53      * Clears the AQL query result cache for the current database
 54      *
 55      * @throws Exception
 56      */
 57     public function clear()
 58     {
 59         $url = UrlHelper::buildUrl(Urls::URL_QUERY_CACHE, []);
 60         $this->getConnection()->delete($url);
 61     }
 62 
 63     /**
 64      * Adjusts the global AQL query result cache properties
 65      *
 66      * @throws Exception
 67      *
 68      * @param  array $properties     - the query result cache properties.
 69      *                               the following properties can be used:
 70      *                               - maxResults: maximum number of results
 71      *                               that the query result cache will hold
 72      *                               per database
 73      *                               - mode: turns the query result cache on or off,
 74      *                               or sets it to demand mode. Possible values are
 75      *                               "on", "off", or "demand".
 76      *
 77      * @return array
 78      */
 79     public function setProperties(array $properties)
 80     {
 81         $bodyParams = $properties;
 82 
 83         $url      = UrlHelper::buildUrl(Urls::URL_QUERY_CACHE);
 84         $response = $this->getConnection()->put($url, $this->json_encode_wrapper($bodyParams));
 85 
 86         return $response->getJson();
 87     }
 88 
 89     /**
 90      * Returns the AQL query result cache properties
 91      *
 92      * @throws Exception
 93      *
 94      * @return array
 95      */
 96     public function getProperties()
 97     {
 98         $url      = UrlHelper::buildUrl(Urls::URL_QUERY_CACHE);
 99         $response = $this->getConnection()->get($url);
100 
101         return $response->getJson();
102     }
103 }
104 
ArangoDB-PHP API Documentation API documentation generated by ApiGen