@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | if ($item instanceof Item) { |
| 74 | 74 | $cacheData = $this->encode($this->driverPreWrap($item)); |
| 75 | 75 | $options = new Cassandra\ExecutionOptions([ |
| 76 | - 'arguments' => [ |
|
| 77 | - 'cache_uuid' => new Cassandra\Uuid(), |
|
| 78 | - 'cache_id' => $item->getKey(), |
|
| 79 | - 'cache_data' => $cacheData, |
|
| 80 | - 'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()), |
|
| 81 | - 'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()), |
|
| 82 | - 'cache_length' => strlen($cacheData) |
|
| 76 | + 'arguments' => [ |
|
| 77 | + 'cache_uuid' => new Cassandra\Uuid(), |
|
| 78 | + 'cache_id' => $item->getKey(), |
|
| 79 | + 'cache_data' => $cacheData, |
|
| 80 | + 'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()), |
|
| 81 | + 'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()), |
|
| 82 | + 'cache_length' => strlen($cacheData) |
|
| 83 | 83 | ], |
| 84 | - 'consistency' => Cassandra::CONSISTENCY_ALL, |
|
| 85 | - 'serial_consistency' => Cassandra::CONSISTENCY_SERIAL |
|
| 84 | + 'consistency' => Cassandra::CONSISTENCY_ALL, |
|
| 85 | + 'serial_consistency' => Cassandra::CONSISTENCY_SERIAL |
|
| 86 | 86 | ]); |
| 87 | 87 | |
| 88 | 88 | $query = sprintf('INSERT INTO %s.%s |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | try { |
| 119 | 119 | $options = new Cassandra\ExecutionOptions([ |
| 120 | - 'arguments' => ['cache_id' => $item->getKey()], |
|
| 121 | - 'page_size' => 1 |
|
| 120 | + 'arguments' => ['cache_id' => $item->getKey()], |
|
| 121 | + 'page_size' => 1 |
|
| 122 | 122 | ]); |
| 123 | 123 | $query = sprintf( |
| 124 | - 'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;', |
|
| 125 | - self::CASSANDRA_KEY_SPACE, |
|
| 126 | - self::CASSANDRA_TABLE |
|
| 124 | + 'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;', |
|
| 125 | + self::CASSANDRA_KEY_SPACE, |
|
| 126 | + self::CASSANDRA_TABLE |
|
| 127 | 127 | ); |
| 128 | 128 | $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options); |
| 129 | 129 | |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | if ($item instanceof Item) { |
| 151 | 151 | try { |
| 152 | 152 | $options = new Cassandra\ExecutionOptions([ |
| 153 | - 'arguments' => [ |
|
| 153 | + 'arguments' => [ |
|
| 154 | 154 | 'cache_id' => $item->getKey(), |
| 155 | - ], |
|
| 155 | + ], |
|
| 156 | 156 | ]); |
| 157 | 157 | $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf( |
| 158 | - 'DELETE FROM %s.%s WHERE cache_id = :cache_id;', |
|
| 159 | - self::CASSANDRA_KEY_SPACE, |
|
| 160 | - self::CASSANDRA_TABLE |
|
| 158 | + 'DELETE FROM %s.%s WHERE cache_id = :cache_id;', |
|
| 159 | + self::CASSANDRA_KEY_SPACE, |
|
| 160 | + self::CASSANDRA_TABLE |
|
| 161 | 161 | )), $options); |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | try { |
| 183 | 183 | $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf( |
| 184 | - 'TRUNCATE %s.%s;', |
|
| 185 | - self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE |
|
| 184 | + 'TRUNCATE %s.%s;', |
|
| 185 | + self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE |
|
| 186 | 186 | ))); |
| 187 | 187 | /** |
| 188 | 188 | * There's no real way atm |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
| 211 | 211 | |
| 212 | 212 | $clusterBuilder = Cassandra::cluster() |
| 213 | - ->withContactPoints($host) |
|
| 214 | - ->withPort($port); |
|
| 213 | + ->withContactPoints($host) |
|
| 214 | + ->withPort($port); |
|
| 215 | 215 | |
| 216 | 216 | if(!empty($this->config['ssl']['enabled'])){ |
| 217 | 217 | if(!empty($this->config['ssl']['verify'])){ |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | |
| 241 | 241 | $this->instance->execute(new Cassandra\SimpleStatement(sprintf( |
| 242 | - "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };", |
|
| 243 | - self::CASSANDRA_KEY_SPACE |
|
| 242 | + "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };", |
|
| 243 | + self::CASSANDRA_KEY_SPACE |
|
| 244 | 244 | ))); |
| 245 | 245 | $this->instance->execute(new Cassandra\SimpleStatement(sprintf('USE %s;', self::CASSANDRA_KEY_SPACE))); |
| 246 | 246 | $this->instance->execute(new Cassandra\SimpleStatement(sprintf(' |
@@ -286,15 +286,15 @@ discard block |
||
| 286 | 286 | public function getStats() |
| 287 | 287 | { |
| 288 | 288 | $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf( |
| 289 | - 'SELECT SUM(cache_length) as cache_size FROM %s.%s', |
|
| 290 | - self::CASSANDRA_KEY_SPACE, |
|
| 291 | - self::CASSANDRA_TABLE |
|
| 289 | + 'SELECT SUM(cache_length) as cache_size FROM %s.%s', |
|
| 290 | + self::CASSANDRA_KEY_SPACE, |
|
| 291 | + self::CASSANDRA_TABLE |
|
| 292 | 292 | ))); |
| 293 | 293 | |
| 294 | 294 | return (new driverStatistic()) |
| 295 | - ->setSize($result->first()[ 'cache_size' ]) |
|
| 296 | - ->setRawData([]) |
|
| 297 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 298 | - ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.'); |
|
| 295 | + ->setSize($result->first()[ 'cache_size' ]) |
|
| 296 | + ->setRawData([]) |
|
| 297 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 298 | + ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.'); |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | \ No newline at end of file |