title: WordPress Store Authentication token in memory
body: <p>I am looking for some help concerning WordPress plugin development. My plugin queries an API which requires an Authentication Token, that token is fetched via a Token delivery APi. The token expire every 3600 seconds.</p>
  <p>I would like to store the Token, in a persistent way (for all sessions , like server side caching) and update it only when needed. Multiple Api call could be done with the same token. The problem is, if I store the token in a global variable, it gets reset each time a user reload a page which uses my plugin.
  <a href="https://wordpress.stackexchange.com/questions/89263/how-to-set-and-use-global-variables-or-why-not-to-use-them-at-all">https://wordpress.stackexchange.com/questions/89263/how-to-set-and-use-global-variables-or-why-not-to-use-them-at-all</a></p>
  <p>After looking for answer I found:</p>
  <p>-WP_CACHE , but it is not persistent.</p>
  <p>-I know I can store the token in the Database, but a Token in Database is not a use case I found elegant</p>
  <p>-Tool such as Redis Object Cache for PHP but I found it to be really complicated , installing etc...</p>
  <p>Is there any good practice or easy way of doing this? I only need to keep a string for an hour and access it within the plugin in PHP.</p>
  <p>Thank you.</p>
  <p><a href="https://wordpress.stackexchange.com/questions/89263/how-to-set-and-use-global-variables-or-why-not-to-use-them-at-all">https://wordpress.stackexchange.com/questions/89263/how-to-set-and-use-global-variables-or-why-not-to-use-them-at-all</a></p>