/
var
/
www
/
cobraambalaj
/
vendor
/
doctrine
/
cache
/
lib
/
Doctrine
/
Common
/
Cache
/
/var/www/cobraambalaj/vendor/doctrine/cache/lib/Doctrine/Common/Cache
mkdir
upload
Name
Size
Mode
Actions
ApcCache.php
2384
0644
edit
dl
rm
ApcuCache.php
2168
0644
edit
dl
rm
ArrayCache.php
2077
0644
edit
dl
rm
Cache.php
2797
0644
edit
dl
rm
CacheProvider.php
8462
0644
edit
dl
rm
ChainCache.php
4847
0644
edit
dl
rm
ClearableCache.php
501
0644
edit
dl
rm
CouchbaseBucketCache.php
4675
0644
edit
dl
rm
CouchbaseCache.php
2320
0644
edit
dl
rm
ExtMongoDBCache.php
5315
0644
edit
dl
rm
FileCache.php
7967
0644
edit
dl
rm
FilesystemCache.php
2061
0644
edit
dl
rm
FlushableCache.php
350
0644
edit
dl
rm
InvalidCacheId.php
740
0644
edit
dl
rm
LegacyMongoDBCache.php
4773
0644
edit
dl
rm
MemcacheCache.php
2120
0644
edit
dl
rm
MemcachedCache.php
3848
0644
edit
dl
rm
MongoDBCache.php
3198
0644
edit
dl
rm
MultiDeleteCache.php
466
0644
edit
dl
rm
MultiGetCache.php
593
0644
edit
dl
rm
MultiOperationCache.php
251
0644
edit
dl
rm
MultiPutCache.php
698
0644
edit
dl
rm
PhpFileCache.php
2675
0644
edit
dl
rm
PredisCache.php
3286
0644
edit
dl
rm
RedisCache.php
4355
0644
edit
dl
rm
SQLite3Cache.php
4635
0644
edit
dl
rm
Version.php
99
0644
edit
dl
rm
VoidCache.php
887
0644
edit
dl
rm
WinCacheCache.php
2294
0644
edit
dl
rm
XcacheCache.php
2210
0644
edit
dl
rm
ZendDataCache.php
1244
0644
edit
dl
rm
Edit:
/var/www/cobraambalaj/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ExtMongoDBCache.php
(5315B)
<?php declare(strict_types=1); namespace Doctrine\Common\Cache; use DateTime; use MongoDB\BSON\Binary; use MongoDB\BSON\UTCDateTime; use MongoDB\Collection; use MongoDB\Database; use MongoDB\Driver\Exception\Exception; use MongoDB\Model\BSONDocument; use function serialize; use function time; use function unserialize; /** * MongoDB cache provider for ext-mongodb * * @internal Do not use - will be removed in 2.0. Use MongoDBCache instead */ class ExtMongoDBCache extends CacheProvider { /** @var Database */ private $database; /** @var Collection */ private $collection; /** @var bool */ private $expirationIndexCreated = false; /** * This provider will default to the write concern and read preference * options set on the Database instance (or inherited from MongoDB or * Client). Using an unacknowledged write concern (< 1) may make the return * values of delete() and save() unreliable. Reading from secondaries may * make contain() and fetch() unreliable. * * @see http://www.php.net/manual/en/mongo.readpreferences.php * @see http://www.php.net/manual/en/mongo.writeconcerns.php */ public function __construct(Collection $collection) { // Ensure there is no typemap set - we want to use our own $this->collection = $collection->withOptions(['typeMap' => null]); $this->database = new Database($collection->getManager(), $collection->getDatabaseName()); } /** * {@inheritdoc} */ protected function doFetch($id) { $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::DATA_FIELD, MongoDBCache::EXPIRATION_FIELD]); if ($document === null) { return false; } if ($this->isExpired($document)) { $this->createExpirationIndex(); $this->doDelete($id); return false; } return unserialize($document[MongoDBCache::DATA_FIELD]->getData()); } /** * {@inheritdoc} */ protected function doContains($id) { $document = $this->collection->findOne(['_id' => $id], [MongoDBCache::EXPIRATION_FIELD]); if ($document === null) { return false; } if ($this->isExpired($document)) { $this->createExpirationIndex(); $this->doDelete($id); return false; } return true; } /** * {@inheritdoc} */ protected function doSave($id, $data, $lifeTime = 0) { try { $this->collection->updateOne( ['_id' => $id], [ '$set' => [ MongoDBCache::EXPIRATION_FIELD => ($lifeTime > 0 ? new UTCDateTime((time() + $lifeTime) * 1000): null), MongoDBCache::DATA_FIELD => new Binary(serialize($data), Binary::TYPE_GENERIC), ], ], ['upsert' => true] ); } catch (Exception $e) { return false; } return true; } /** * {@inheritdoc} */ protected function doDelete($id) { try { $this->collection->deleteOne(['_id' => $id]); } catch (Exception $e) { return false; } return true; } /** * {@inheritdoc} */ protected function doFlush() { try { // Use remove() in lieu of drop() to maintain any collection indexes $this->collection->deleteMany([]); } catch (Exception $e) { return false; } return true; } /** * {@inheritdoc} */ protected function doGetStats() { $uptime = null; $memoryUsage = null; try { $serverStatus = $this->database->command([ 'serverStatus' => 1, 'locks' => 0, 'metrics' => 0, 'recordStats' => 0, 'repl' => 0, ])->toArray()[0]; $uptime = $serverStatus['uptime'] ?? null; } catch (Exception $e) { } try { $collStats = $this->database->command(['collStats' => $this->collection->getCollectionName()])->toArray()[0]; $memoryUsage = $collStats['size'] ?? null; } catch (Exception $e) { } return [ Cache::STATS_HITS => null, Cache::STATS_MISSES => null, Cache::STATS_UPTIME => $uptime, Cache::STATS_MEMORY_USAGE => $memoryUsage, Cache::STATS_MEMORY_AVAILABLE => null, ]; } /** * Check if the document is expired. */ private function isExpired(BSONDocument $document) : bool { return isset($document[MongoDBCache::EXPIRATION_FIELD]) && $document[MongoDBCache::EXPIRATION_FIELD] instanceof UTCDateTime && $document[MongoDBCache::EXPIRATION_FIELD]->toDateTime() < new DateTime(); } private function createExpirationIndex() : void { if ($this->expirationIndexCreated) { return; } $this->collection->createIndex([MongoDBCache::EXPIRATION_FIELD => 1], ['background' => true, 'expireAfterSeconds' => 0]); } }
Save
cmd:
run