Skip to content

Latest commit

 

History

History
130 lines (86 loc) · 2.23 KB

File metadata and controls

130 lines (86 loc) · 2.23 KB

API Reference

Always define the driver to be used in the first instance, and only then define the settings using setConfig().

Check it out below: API Reference - setDriver()

setConfig()

<?php

require_once __DIR__ . "/../vendor/autoload.php"; 

$Cacheer = new Cacheer();
$Cacheer->setConfig();
Cacheer::setConfig();

Note: Configuration methods can also be called statically, e.g. Cacheer::setConfig()->setDatabaseConnection('mysql');

Configures the database for storing the cache.

<?php

require_once __DIR__ . "/../vendor/autoload.php"; 

$Cacheer = new Cacheer();
$Cacheer->setConfig()->setDatabaseConnection(string $driver)
Cacheer::setConfig()->setDatabaseConnection(string $driver);
  • Parameters:
$driver: Database driver. Possible values: 'mysql', 'pgsql', 'sqlite'.

Example:

<?php

require_once __DIR__ . "/../vendor/autoload.php"; 

$Cacheer = new Cacheer();
$Cacheer->setConfig()->setDatabaseConnection('mysql');
Cacheer::setConfig()->setDatabaseConnection('mysql');

There is also an alternative, which is to define the driver in the .env file, through the DB_CONNECTION variable, passing the same values.

Timezone

<?php

require_once __DIR__ . "/../vendor/autoload.php"; 

$Cacheer = new Cacheer();
$Cacheer->setConfig()->setTimeZone(string $timezone);
Cacheer::setConfig()->setTimeZone(string $timezone);

Sets the time zone for cache operations.

  • Parameters
<?php
$timezone: Time zone in PHP format (example: 'UTC', 'Africa/Luanda').

Example:

$Cacheer->setConfig()->setTimeZone('UTC');
Cacheer::setConfig()->setTimeZone('UTC');

Check out the timezones supported by PHP here: https://www.php.net/manual/en/timezones.php

Logger

$Cacheer->setConfig()->setLoggerPath(string $path);
Cacheer::setConfig()->setLoggerPath(string $path);

Defines the path where the logs will be stored.

  • Parameters
$path: Caminho completo para o arquivo de logs.

Example:

$Cacheer->setConfig()->setLoggerPath('/path/to/logs/CacheerPHP.log');
Cacheer::setConfig()->setLoggerPath('/path/to/logs/CacheerPHP.log');