You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
I'm using Laravel Vapor for a serverless project and also I'm using DynamoDB as a caching system. I just realized that flush method is throwing and Exception:
/** * Remove all items from the cache. * * @return bool * * @throws \RuntimeException */publicfunctionflush()
{
thrownewRuntimeException('DynamoDb does not support flushing an entire table. Please create a new table.');
}
I don't understand why because it can be implemented by using the DynamoDbClient::scan method and then delete all items looping through them or just deleting the table and recreating it again.
Here is my approach:
// @method \Aws\Result scan(array $args = []) <== This is from DynamoDBClient class/** * Remove all items from the cache. * * @return bool */publicfunctionflush()
{
// This returns the entire items list on dynamoDB table$items = $this->dynamo->scan([
'TableName' => $this->table,
...what ever the options thisAPI call needs ....
]);
$result = true;
// I dont know how the scan method result and item structure are but suppose it has a getKey() method to get the key....foreach($itemsas$item){
$result = $this->forget($item->getKey()) && $result;
}
// if all items could be deleted then flush will return true, else false.return$result;
}
So what do you think? Hope could be implemented.
Thanks in advance.
The text was updated successfully, but these errors were encountered:
didix16
changed the title
[Proposal] Enable flush method from dynamoDB
[Feature] Enable flush method from dynamoDB
Jun 29, 2021
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi everyone,
I'm using Laravel Vapor for a serverless project and also I'm using DynamoDB as a caching system. I just realized that flush method is throwing and Exception:
I don't understand why because it can be implemented by using the DynamoDbClient::scan method and then delete all items looping through them or just deleting the table and recreating it again.
Here is my approach:
So what do you think? Hope could be implemented.
Thanks in advance.
The text was updated successfully, but these errors were encountered: