403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/data/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/data/cacheengineapc.php
<?php

namespace Bitrix\Main\Data;

use Bitrix\Main\Data\LocalStorage\Storage;

class CacheEngineApc extends Cache\KeyValueEngine implements Storage\CacheEngineInterface
{
	public function getConnectionName(): string
	{
		return '';
	}

	public static function getConnectionClass()
	{
		return CacheEngineApc::class;
	}

	protected function connect($config)
	{
		self::$isConnected = function_exists('apcu_fetch') && 'cli' !== \PHP_SAPI;
	}

	public function set($key, $ttl, $value)
	{
		return apcu_store($key, $value, $ttl);
	}

	public function get($key)
	{
		return apcu_fetch($key);
	}

	public function del($key)
	{
		apcu_delete($key);
	}

	public function setNotExists($key, $ttl, $value)
	{
		$ttl = (int) $ttl;
		return apcu_add($key, $value, $ttl);
	}

	public function checkInSet($key, $value) : bool
	{
		$list = apcu_fetch($key);

		if (!is_array($list))
		{
			$list = [];
		}

		if (array_key_exists($value, $list))
		{
			return true;
		}

		return false;
	}

	public function addToSet($key, $value)
	{
		$list = apcu_fetch($key);

		if (!is_array($list))
		{
			$list = [];
		}

		if (!array_key_exists($value, $list))
		{
			$list[$value] = 1;
			apcu_store($key, $list, 0);
		}
	}

	public function getSet($key) : array
	{
		$list = apcu_fetch($key);
		if (!is_array($list) || empty($list))
		{
			return [];
		}

		return array_keys($list);
	}

	public function deleteBySet($key, $prefix = '')
	{
		$list = apcu_fetch($key);
		apcu_delete($key);

		if (is_array($list) && !empty($list))
		{
			array_walk($list, function ($value, $key) {
				apcu_delete($key);
			});
			unset($list);
		}
	}

	public function delFromSet($key, $member)
	{
		$list = apcu_fetch($key);

		if (is_array($list) && !empty($list))
		{
			$rewrite = false;
			if (!is_array($member))
			{
				$member = [0 => $member];
			}

			foreach ($member as $keyID)
			{
				if (array_key_exists($keyID, $list))
				{
					$rewrite = true;
					unset($list[$keyID]);
				}
			}

			if ($rewrite)
			{
				if (empty($list))
				{
					apcu_delete($key);
				}
				else
				{
					apcu_store($key, $list, 0);
				}
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit