| @@ 71-83 (lines=13) @@ | ||
| 68 | * @return mixed |
|
| 69 | * @throws \InvalidArgumentException |
|
| 70 | */ |
|
| 71 | protected function driverWrite(CacheItemInterface $item) |
|
| 72 | { |
|
| 73 | /** |
|
| 74 | * Check for Cross-Driver type confusion |
|
| 75 | */ |
|
| 76 | if ($item instanceof Item) { |
|
| 77 | $ttl = $item->getExpirationDate()->getTimestamp() - time(); |
|
| 78 | ||
| 79 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
|
| 80 | } else { |
|
| 81 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @param \Psr\Cache\CacheItemInterface $item |
|
| @@ 62-74 (lines=13) @@ | ||
| 59 | * @return mixed |
|
| 60 | * @throws \InvalidArgumentException |
|
| 61 | */ |
|
| 62 | protected function driverWrite(CacheItemInterface $item) |
|
| 63 | { |
|
| 64 | /** |
|
| 65 | * Check for Cross-Driver type confusion |
|
| 66 | */ |
|
| 67 | if ($item instanceof Item) { |
|
| 68 | $ttl = $item->getExpirationDate()->getTimestamp() - time(); |
|
| 69 | ||
| 70 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
|
| 71 | } else { |
|
| 72 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
|
| 73 | } |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @param \Psr\Cache\CacheItemInterface $item |
|
| @@ 74-93 (lines=20) @@ | ||
| 71 | * @return mixed |
|
| 72 | * @throws \InvalidArgumentException |
|
| 73 | */ |
|
| 74 | protected function driverWrite(CacheItemInterface $item) |
|
| 75 | { |
|
| 76 | /** |
|
| 77 | * Check for Cross-Driver type confusion |
|
| 78 | */ |
|
| 79 | if ($item instanceof Item) { |
|
| 80 | /* if (isset($this->config[ 'skipExisting' ]) && $this->config[ 'skipExisting' ] == true) { |
|
| 81 | $x = $this->instance->get($item->getKey()); |
|
| 82 | if ($x === false) { |
|
| 83 | return false; |
|
| 84 | } elseif (!is_null($x)) { |
|
| 85 | return true; |
|
| 86 | } |
|
| 87 | }*/ |
|
| 88 | ||
| 89 | return $this->instance->setx($item->getKey(), $this->encode($this->driverPreWrap($item)), $item->getTtl()); |
|
| 90 | } else { |
|
| 91 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
|
| 92 | } |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * @param \Psr\Cache\CacheItemInterface $item |
|