Refactor cache handling in VariableManager and update configuration options
Some checks are pending
CI / debug (push) Waiting to run
CI / release_executable (push) Waiting to run
CI / release (push) Waiting to run
CI / debug_executable (push) Waiting to run
CI / check-phpunit (push) Waiting to run
CI / check-phpdoc (push) Waiting to run
CI / generate-phpdoc (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / release-documentation (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
Some checks are pending
CI / debug (push) Waiting to run
CI / release_executable (push) Waiting to run
CI / release (push) Waiting to run
CI / debug_executable (push) Waiting to run
CI / check-phpunit (push) Waiting to run
CI / check-phpdoc (push) Waiting to run
CI / generate-phpdoc (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / release-documentation (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
This commit is contained in:
parent
bbeb388e88
commit
c95cdcd4da
5 changed files with 146 additions and 134 deletions
|
@ -50,4 +50,5 @@
|
||||||
|
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,14 +3,11 @@
|
||||||
namespace Socialbox\Classes\CliCommands;
|
namespace Socialbox\Classes\CliCommands;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use ncc\CLI\Main;
|
|
||||||
use ncc\ThirdParty\Symfony\Process\Exception\InvalidArgumentException;
|
use ncc\ThirdParty\Symfony\Process\Exception\InvalidArgumentException;
|
||||||
use PDOException;
|
use PDOException;
|
||||||
use Socialbox\Abstracts\CacheLayer;
|
|
||||||
use Socialbox\Classes\Configuration;
|
use Socialbox\Classes\Configuration;
|
||||||
use Socialbox\Classes\Cryptography;
|
use Socialbox\Classes\Cryptography;
|
||||||
use Socialbox\Classes\Database;
|
use Socialbox\Classes\Database;
|
||||||
use Socialbox\Classes\Logger;
|
|
||||||
use Socialbox\Classes\Resources;
|
use Socialbox\Classes\Resources;
|
||||||
use Socialbox\Enums\DatabaseObjects;
|
use Socialbox\Enums\DatabaseObjects;
|
||||||
use Socialbox\Exceptions\CryptographyException;
|
use Socialbox\Exceptions\CryptographyException;
|
||||||
|
@ -92,7 +89,8 @@
|
||||||
if(Configuration::getCacheConfiguration()->isEnabled())
|
if(Configuration::getCacheConfiguration()->isEnabled())
|
||||||
{
|
{
|
||||||
Program::getLogger()->verbose('Clearing cache layer...');
|
Program::getLogger()->verbose('Clearing cache layer...');
|
||||||
CacheLayer::getInstance()->clear();
|
// TODO: Re-implement cache layer
|
||||||
|
//CacheLayer::getInstance()->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(DatabaseObjects::casesOrdered() as $object)
|
foreach(DatabaseObjects::casesOrdered() as $object)
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Socialbox\Managers;
|
namespace Socialbox\Managers;
|
||||||
|
|
||||||
use PDO;
|
use PDO;
|
||||||
use PDOException;
|
use PDOException;
|
||||||
use Socialbox\Abstracts\CacheLayer;
|
use Socialbox\Classes\CacheLayer;
|
||||||
use Socialbox\Classes\Configuration;
|
use Socialbox\Classes\Configuration;
|
||||||
use Socialbox\Classes\Database;
|
use Socialbox\Classes\Database;
|
||||||
use Socialbox\Exceptions\DatabaseOperationException;
|
use Socialbox\Exceptions\DatabaseOperationException;
|
||||||
|
|
||||||
class VariableManager
|
class VariableManager
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Sets a variable in the database. If the variable already exists, its value is updated.
|
* Sets a variable in the database. If the variable already exists, its value is updated.
|
||||||
*
|
*
|
||||||
|
@ -33,22 +33,23 @@ class VariableManager
|
||||||
{
|
{
|
||||||
throw new DatabaseOperationException(sprintf('Failed to set variable %s in the database', $name), $e);
|
throw new DatabaseOperationException(sprintf('Failed to set variable %s in the database', $name), $e);
|
||||||
}
|
}
|
||||||
finally
|
// TODO: Re-implement caching
|
||||||
{
|
//finally
|
||||||
if(Configuration::getConfiguration()['cache']['enabled'] && Configuration::getConfiguration()['cache']['variables']['enabled'])
|
//{
|
||||||
{
|
//if(Configuration::getConfiguration()['cache']['enabled'] && Configuration::getConfiguration()['cache']['variables']['enabled'])
|
||||||
if(Configuration::getConfiguration()['cache']['variables']['max'] > 0)
|
//{
|
||||||
{
|
// if(Configuration::getConfiguration()['cache']['variables']['max'] > 0)
|
||||||
if(CacheLayer::getInstance()->getPrefixCount('VARIABLES_') >= Configuration::getConfiguration()['cache']['variables']['max'])
|
// {
|
||||||
{
|
// if(CacheLayer::getPrefixCount('VARIABLES_') >= Configuration::getConfiguration()['cache']['variables']['max'])
|
||||||
// Return early if the cache is full
|
// {
|
||||||
return;
|
// // Return early if the cache is full
|
||||||
}
|
// return;
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
CacheLayer::getInstance()->set(sprintf("VARIABLES_%s", $name), $value, (int)Configuration::getConfiguration()['cache']['variables']['ttl']);
|
// CacheLayer::getInstance()->set(sprintf("VARIABLES_%s", $name), $value, (int)Configuration::getConfiguration()['cache']['variables']['ttl']);
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,4 +149,4 @@ class VariableManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -107,7 +107,13 @@
|
||||||
"default_email_address_privacy": "CONTACTS",
|
"default_email_address_privacy": "CONTACTS",
|
||||||
"default_phone_number_privacy": "CONTACTS",
|
"default_phone_number_privacy": "CONTACTS",
|
||||||
"default_birthday_privacy": "PRIVATE",
|
"default_birthday_privacy": "PRIVATE",
|
||||||
"default_url_privacy": "PUBLIC"
|
"default_url_privacy": "PUBLIC",
|
||||||
|
"max_contact_signing_keys": 50,
|
||||||
|
"get_encryption_channel_requests_limit": 100,
|
||||||
|
"get_encryption_channels_limit": 100,
|
||||||
|
"get_encryption_channel_incoming_limit": 100,
|
||||||
|
"get_encryption_channel_outgoing_limit": 100,
|
||||||
|
"encryption_channel_max_messages": 100
|
||||||
},
|
},
|
||||||
"storage": {
|
"storage": {
|
||||||
"path": "/etc/socialbox",
|
"path": "/etc/socialbox",
|
||||||
|
|
|
@ -107,7 +107,13 @@
|
||||||
"default_email_address_privacy": "CONTACTS",
|
"default_email_address_privacy": "CONTACTS",
|
||||||
"default_phone_number_privacy": "CONTACTS",
|
"default_phone_number_privacy": "CONTACTS",
|
||||||
"default_birthday_privacy": "PRIVATE",
|
"default_birthday_privacy": "PRIVATE",
|
||||||
"default_url_privacy": "PUBLIC"
|
"default_url_privacy": "PUBLIC",
|
||||||
|
"max_contact_signing_keys": 50,
|
||||||
|
"get_encryption_channel_requests_limit": 100,
|
||||||
|
"get_encryption_channels_limit": 100,
|
||||||
|
"get_encryption_channel_incoming_limit": 100,
|
||||||
|
"get_encryption_channel_outgoing_limit": 100,
|
||||||
|
"encryption_channel_max_messages": 100
|
||||||
},
|
},
|
||||||
"storage": {
|
"storage": {
|
||||||
"path": "/etc/socialbox",
|
"path": "/etc/socialbox",
|
||||||
|
|
Loading…
Add table
Reference in a new issue