Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jul 22, 2024
1 parent 8469220 commit 00dfdf4
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions src/Illuminate/Cache/DatabaseStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public function many(array $keys)

$results = array_fill_keys($keys, null);

// First we will retrieve all of the items from the cache using their keys and
// the prefix value. Then we will need to iterate through each of the items
// and convert them to an object when they are currently in array format.
$values = $this->table()
->whereIn('key', array_map(function ($key) {
return $this->prefix.$key;
Expand Down Expand Up @@ -170,6 +173,7 @@ public function put($key, $value, $seconds)
public function putMany(array $values, $seconds)
{
$serializedValues = [];

$expiration = $this->getTime() + $seconds;

foreach ($values as $key => $value) {
Expand Down Expand Up @@ -369,19 +373,10 @@ public function forgetIfExpired($key)
/**
* Remove all items from the cache.
*
* @param array $keys
* @return bool
*/
public function flush()
{
$this->table()->delete();

return true;
}

/**
* Remove all items from the cache.
*/
protected function forgetMany(array $keys): bool
protected function forgetMany(array $keys)
{
$this->table()->whereIn('key', array_map(function ($key) {
return $this->prefix.$key;
Expand All @@ -392,8 +387,12 @@ protected function forgetMany(array $keys): bool

/**
* Remove all expired items from the given set from the cache.
*
* @param array $keys
* @param bool $prefixed
* @return bool
*/
protected function forgetManyIfExpired(array $keys, bool $prefixed = false): bool
protected function forgetManyIfExpired(array $keys, bool $prefixed = false)
{
$this->table()
->whereIn('key', $prefixed ? $keys : array_map(function ($key) {
Expand All @@ -405,6 +404,18 @@ protected function forgetManyIfExpired(array $keys, bool $prefixed = false): boo
return true;
}

/**
* Remove all items from the cache.
*
* @return bool
*/
public function flush()
{
$this->table()->delete();

return true;
}

/**
* Get a query builder for the cache table.
*
Expand Down

0 comments on commit 00dfdf4

Please sign in to comment.