예제 #1
0
 /**
  * @param string $key
  *
  * @return bool
  */
 public function remove($key)
 {
     if ($this->fast->remove($key)) {
         return $this->slow->remove($key);
     }
     return false;
 }
예제 #2
0
 /**
  * @param DriverInterface $driver
  * @param array $configs
  * @throws DriverNotInstalledException
  * @return DriverAdapterInterface
  */
 public function setDriver(DriverInterface $driver, array $configs = [])
 {
     $driver->boot($configs);
     if (true !== $driver->check()) {
         throw new DriverNotInstalledException(sprintf('%s sürücünüz kullanıma hazır değil.', get_class($driver)));
     }
     return $this->adapter($driver);
 }
예제 #3
0
 /**
  * {@inheritDoc}
  */
 public function setFallback(DriverInterface $driver)
 {
     if ($driver->ping()) {
         $this->fallback = $driver;
         return $this->trueAndFlushError();
     } else {
         return $this->falseAndSetError($driver->getError(), $driver->getErrorCode());
     }
 }
예제 #4
0
 /**
  * Loads items information as quickly as possible (no direct calls to the ILS).  Does do filtering by loan rules
  *
  * return is an array of items with the following information:
  *  location
  *  callnumber
  *  available
  *  holdable
  *  lastStatusCheck (time)
  *
  * @param $id
  * @param $scopingEnabled
  * @param $marcRecord
  * @return mixed
  */
 public function getItemsFast($id, $scopingEnabled, $marcRecord = null)
 {
     /** @var Memcache $memCache */
     global $memCache;
     $key = 'items_fast_' . $id . '_' . $scopingEnabled;
     $cachedValue = $memCache->get($key);
     if ($cachedValue == false || isset($_REQUEST['reload'])) {
         global $configArray;
         $cachedValue = $this->driver->getItemsFast($id, $scopingEnabled, $marcRecord);
         $memCache->add($key, $cachedValue, 0, $configArray['Caching']['item_data']);
     }
     return $cachedValue;
 }
 /**
  * StandardDirectory constructor.
  *
  * @param DriverInterface  $driver
  * @param                  $path
  * @param array|null       $contents
  */
 public function __construct(DriverInterface $driver, $path, array $contents = null)
 {
     $this->driver = $driver;
     $this->path = $path;
     $this->position = 0;
     $this->contents = [];
     // Check contents
     foreach ((array) $contents as $content) {
         $adapterClass = get_class($this->driver);
         if (is_string($content)) {
             $content = $this->driver->info($content);
         }
         if (!$content instanceof InfoInterface) {
             // Throw or ignore?
             continue;
         }
         // Wrong adapter
         if (get_class($content->getDriver()) != $adapterClass) {
             // Throw or ignore?
             continue;
         }
         $this->contents[] = $content;
     }
 }
예제 #6
0
 public function clear()
 {
     return $this->driver->clear();
 }
예제 #7
0
 /**
  * Add a Mapping Driver
  *
  * @param \Analogue\ORM\Drivers\DriverInterface $driver
  */
 public function addDriver(DriverInterface $driver)
 {
     $this->drivers[$driver->getName()] = $driver;
 }
예제 #8
0
 /**
  * Get all fields
  * @return array
  */
 public function getFields()
 {
     return $this->driver->getFieldsMetadata($this->className);
 }
예제 #9
0
 /**
  * @return mixed
  */
 public function getFileInfo()
 {
     return $this->driver->info($this->path);
 }