ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,45 @@
<?php
namespace Lts\Sales\Helper;
use Credis_Client;
use Magento\Framework\App\DeploymentConfig;
class CredisStorage
{
private Credis_Client $redis;
public function __construct(DeploymentConfig $deploymentConfig)
{
$options = (array) $deploymentConfig->get(
'cache/frontend/default/backend_options'
);
$this->redis = new Credis_Client(
$options['server'] ?? '127.0.0.1',
(int)($options['port'] ?? 6379),
(float)($options['timeout'] ?? 2.5),
'',
(int)($options['database'] ?? 0),
$options['password'] ?? null
);
if (!empty($options['key_prefix'])) {
$this->redis->setPrefix($options['key_prefix']);
}
}
public function get(string $key)
{
return $this->redis->SMEMBERS($key);
}
public function set(string $key, $value)
{
$this->redis->sAdd($key, $value);
}
public function isExist(string $key, $value) {
return $this->redis->sIsMember($key, $value);
}
}