File Manager Lite
Dir:
/home/codewavebd/public_html/vendor/laravel/framework/src/Illuminate/Cache
Upload
[..]
ApcStore.php (3 KB)
Edit
Rename
Del
ApcWrapper.php (1.4 KB)
Edit
Rename
Del
CacheLock.php (1.77 KB)
Edit
Rename
Del
CacheManager.php (15.52 KB)
Edit
Rename
Del
Console/
Rename
Del
DynamoDbLock.php (1.53 KB)
Edit
Rename
Del
DynamoDbStore.php (15.71 KB)
Edit
Rename
Del
Events/
Rename
Del
FailoverStore.php (6.69 KB)
Edit
Rename
Del
LICENSE.md (1.05 KB)
Edit
Rename
Del
Limiters/
Rename
Del
Lock.php (4.09 KB)
Edit
Rename
Del
MemcachedConnector.php (2.33 KB)
Edit
Rename
Del
MemcachedLock.php (1.4 KB)
Edit
Rename
Del
MemcachedStore.php (6.42 KB)
Edit
Rename
Del
MemoizedStore.php (6.64 KB)
Edit
Rename
Del
NoLock.php (870 B)
Edit
Rename
Del
NullStore.php (2.92 KB)
Edit
Rename
Del
PhpRedisLock.php (809 B)
Edit
Rename
Del
RateLimiter.php (7.71 KB)
Edit
Rename
Del
RateLimiting/
Rename
Del
RedisLock.php (1.72 KB)
Edit
Rename
Del
RedisStore.php (14.73 KB)
Edit
Rename
Del
RedisTagSet.php (3.82 KB)
Edit
Rename
Del
RedisTaggedCache.php (5.79 KB)
Edit
Rename
Del
Repository.php (28.4 KB)
Edit
Rename
Del
RetrievesMultipleKeys.php (1.25 KB)
Edit
Rename
Del
SessionStore.php (4.67 KB)
Edit
Rename
Del
StorageStore.php (7.08 KB)
Edit
Rename
Del
TagSet.php (2.44 KB)
Edit
Rename
Del
TaggableStore.php (415 B)
Edit
Rename
Del
TaggedCache.php (2.82 KB)
Edit
Rename
Del
composer.json (1.5 KB)
Edit
Rename
Del
Edit: SessionStore.php
<?php namespace Illuminate\Cache; use Illuminate\Contracts\Cache\Store; use Illuminate\Support\Carbon; use Illuminate\Support\InteractsWithTime; class SessionStore implements Store { use InteractsWithTime, RetrievesMultipleKeys; /** * The key for cache items. * * @var string */ public $key; /** * The session instance. * * @var \Illuminate\Contracts\Session\Session */ public $session; /** * Create a new session cache store. * * @param \Illuminate\Contracts\Session\Session $session * @param string $key */ public function __construct($session, $key = '_cache') { $this->key = $key; $this->session = $session; } /** * Get all of the cached values and their expiration times. * * @return array<string, array{value: mixed, expiresAt: float}> */ public function all() { return $this->session->get($this->key, []); } /** * Retrieve an item from the cache by key. * * @param string $key * @return mixed */ public function get($key) { if (! $this->session->exists($this->itemKey($key))) { return; } $item = $this->session->get($this->itemKey($key)); $expiresAt = $item['expiresAt'] ?? 0; if ($this->isExpired($expiresAt)) { $this->forget($key); return; } return $item['value']; } /** * Determine if the given expiration time is expired. * * @param int|float $expiresAt * @return bool */ protected function isExpired($expiresAt) { return $expiresAt !== 0 && (Carbon::now()->getPreciseTimestamp(3) / 1000) >= $expiresAt; } /** * Store an item in the cache for a given number of seconds. * * @param string $key * @param mixed $value * @param int $seconds * @return bool */ public function put($key, $value, $seconds) { $this->session->put($this->itemKey($key), [ 'value' => $value, 'expiresAt' => $this->toTimestamp($seconds), ]); return true; } /** * Get the UNIX timestamp, with milliseconds, for the given number of seconds in the future. * * @param int $seconds * @return float */ protected function toTimestamp($seconds) { return $seconds > 0 ? (Carbon::now()->getPreciseTimestamp(3) / 1000) + $seconds : 0; } /** * Increment the value of an item in the cache. * * @param string $key * @param mixed $value * @return int */ public function increment($key, $value = 1) { if (! is_null($existing = $this->get($key))) { return tap(((int) $existing) + $value, function ($incremented) use ($key) { $this->session->put($this->itemKey("{$key}.value"), $incremented); }); } $this->forever($key, $value); return $value; } /** * Decrement the value of an item in the cache. * * @param string $key * @param mixed $value * @return int */ public function decrement($key, $value = 1) { return $this->increment($key, $value * -1); } /** * Store an item in the cache indefinitely. * * @param string $key * @param mixed $value * @return bool */ public function forever($key, $value) { return $this->put($key, $value, 0); } /** * Adjust the expiration time of a cached item. * * @param string $key * @param int $seconds * @return bool */ public function touch($key, $seconds) { $value = $this->get($key); if (is_null($value)) { return false; } $this->put($key, $value, $seconds); return true; } /** * Remove an item from the cache. * * @param string $key * @return bool */ public function forget($key) { if ($this->session->exists($this->itemKey($key))) { $this->session->forget($this->itemKey($key)); return true; } return false; } /** * Remove all items from the cache. * * @return bool */ public function flush() { $this->session->put($this->key, []); return true; } /** * Get the cache key prefix. * * @return string */ public function itemKey($key) { return "{$this->key}.{$key}"; } /** * Get the cache key prefix. * * @return string */ public function getPrefix() { return ''; } }
Simpan