public static function createCollection(Manager $manager, $database, $collection) { $collection = new Collection($manager, $database, $collection); $collection->createIndex(['expireAt' => 1], ['expireAfterSeconds' => 0]); return $collection; }
public function createCachePool() { $manager = new Manager("mongodb://" . getenv('MONGODB_HOST')); // In your own code, only do this *once* to initialize your cache $collection = MongoDBCachePool::createCollection($manager, getenv('MONGODB_COLLECTION')); return new MongoDBCachePool($collection); }