Skip to content

Commit

Permalink
Merge branch 'release/v0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Mar 22, 2024
2 parents 3f211c0 + 9af93d5 commit d80d0a8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.5.0 (2024-03-22)
* Renamed FileStore multi-get methods to scan*()

## v0.4.1 (2024-03-21)
* Added TTL to FileStore fetch()
* Fixed FileStore get() TTL
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
"extra": {
"branch-alias": {
"dev-develop": "0.4.x-dev"
"dev-develop": "0.5.x-dev"
}
}
}
17 changes: 12 additions & 5 deletions src/Stash/FileStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function get(
* @param iterable<string> $keys
* @return iterable<string, File>
*/
public function getMultiple(
public function scan(
iterable $keys,
DateInterval|string|Stringable|int $ttl
): iterable;
Expand All @@ -95,7 +95,7 @@ public function getMultiple(
*
* @return iterable<string, File>
*/
public function getOlderThan(
public function scanOlderThan(
DateInterval|string|Stringable|int $ttl
): iterable;

Expand All @@ -104,7 +104,7 @@ public function getOlderThan(
*
* @return iterable<string, File>
*/
public function getBeginningWith(
public function scanBeginningWith(
string $prefix
): iterable;

Expand All @@ -113,16 +113,23 @@ public function getBeginningWith(
*
* @return iterable<string, File>
*/
public function getMatches(
public function scanMatches(
string $pattern
): iterable;

/**
* Get list of all files
*
* @return iterable<string, File>
*/
public function scanAll(): iterable;

/**
* Get list of file name keys
*
* @return iterable<string>
*/
public function getKeys(): iterable;
public function scanKeys(): iterable;

/**
* Get date the file was stored
Expand Down
22 changes: 13 additions & 9 deletions src/Stash/FileStore/Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function get(
* @param iterable<string> $keys
* @return iterable<string, ?File>
*/
public function getMultiple(
public function scan(
iterable $keys,
DateInterval|string|Stringable|int|null $ttl = null
): iterable {
Expand All @@ -189,7 +189,7 @@ public function getMultiple(
}


public function getOlderThan(
public function scanOlderThan(
DateInterval|string|Stringable|int $ttl
): iterable {
$output = [];
Expand All @@ -205,7 +205,7 @@ public function getOlderThan(
return $output;
}

public function getBeginningWith(
public function scanBeginningWith(
string $prefix
): iterable {
$prefix = $this->normalizeKey($prefix);
Expand All @@ -223,7 +223,7 @@ public function getBeginningWith(
return $output;
}

public function getMatches(
public function scanMatches(
string $pattern
): iterable {
$output = [];
Expand All @@ -239,15 +239,19 @@ public function getMatches(
return $output;
}

public function getKeys(): iterable
public function scanAll(): iterable
{
$output = [];

foreach ($this->dir->scanFiles() as $name => $file) {
$output[] = substr($name, strlen($this->prefix), -strlen(self::EXTENSION));
$name = substr($name, strlen($this->prefix), -strlen(self::EXTENSION));
yield $name => $file;
}
}

return $output;
public function scanKeys(): iterable
{
foreach ($this->dir->scanFiles() as $name => $file) {
yield substr($name, strlen($this->prefix), -strlen(self::EXTENSION));
}
}

public function getCreationDate(
Expand Down

0 comments on commit d80d0a8

Please sign in to comment.