vector88/cachefs

CacheFS for PHP

1.0.0 2017-06-27 09:26 UTC

This package is not auto-updated.

Last update: 2024-11-10 04:17:21 UTC


README

Cache Filesystem for PHP.

This package is made from code included in Ron Shpasser's GAE Support for Lumen Library (Released under the MIT License).

Installation

composer require vector88/cachefs

Usage

  1. Register the cachefs stream handler.

    <?php
    
    \Vector88\CacheFS\CacheFS::register();
  2. Use the cachefs stream handler.

    <?php
    
    $fh = fopen( 'cachefs://some/file', 'w' );
    fwrite( $fh, 'file content' );
    fclose( $fh );
    
    // ...
    
    $fh = fopen( 'cachefs://some/file', 'r' );
    $content = fread( $fh, filesize( 'cachefs://some/file' ) );
    fclose( $fh );