betorcs/file-store

Library to manage file by key

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/betorcs/file-store

v1.0.01 2023-01-09 20:01 UTC

This package is auto-updated.

Last update: 2026-01-10 02:29:56 UTC


README

FILE STORE

it's a shave implementation of file store based in keys, useful to handle temporary files.

Installation

Install using composer.

composer require betorcs/file-store

Example usage

$fileContent = ...

$baseDir = '/tmp';

$fileStore = new \Betorcs\LocalFileStore($baseDir);

// Saves a file content with expiration of 120 seconds, then returns a key.
$key = $fileStore->store($fileContent, 120);


// Deletes all expired contents
$fileStore->deleteAllExpired();

// Checkes if exists a non expired content
if ($fileStore->exists($key)) 
{
    // It's TRUE if exists
}

// Retrieve a content from given key, if it exists and non expired
$content = $fileStore->restore($key);

// Deletes all contents
$fileStore->clean();