HEX
Server: LiteSpeed
System: Linux sv4.hami.host 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User: armgroup (1008)
PHP: 8.2.32
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, mail, socket_create, socket_create_listen, socket_create_pair, link, dl, openlog, syslog, stream_socket_server, curl_multi_init
Upload Files
File: /home/armgroup/libs/vendor/chillerlan/php-cache/src/CacheOptionsTrait.php
<?php
/**
 * Trait CacheOptionsTrait
 *
 * @created      08.08.2018
 * @author       smiley <smiley@chillerlan.net>
 * @copyright    2018 smiley
 * @license      MIT
 */

namespace chillerlan\SimpleCache;

use function is_dir, is_writable, realpath, rtrim, sprintf;
use const DIRECTORY_SEPARATOR;

trait CacheOptionsTrait{

	/**
	 * the file storage root directory
	 */
	protected string $cacheFilestorage = '';

	/**
	 * the key name for the session cache
	 */
	protected string $cacheSessionkey  = '_session_cache';

	/**
	 * @throws \Psr\SimpleCache\CacheException
	 */
	protected function set_cacheFilestorage(string $dir):void{
		$dir = rtrim($dir, '\\/');

		if(!is_dir($dir)){
			throw new CacheException(sprintf('invalid cachedir "%s"', $dir));
		}

		if(!is_writable($dir)){
			throw new CacheException('cachedir is read-only. permissions?');
		}

		$this->cacheFilestorage = realpath($dir).DIRECTORY_SEPARATOR;
	}

}