noccylabs/resourceful

$ git tag


$ git branch
* master

Resource types

Container

The container maps to a directory.

ResourceManager::bindResource("data", ResourceManager::TYPE_CONTAINER)
    ->setLimit("4G")        // limit the amount of data that can be written
    ->setWritable(true);    // set to false to protect

Cache

The cache adapter stores its data in ~/.cache/{appname}/ with filenames flattened using sha1. If the disk usage exceeds the limit, the oldest items will be deleted to make room for the new data.

ResourceManager::bindResource("cache", ResourceManager::TYPE_CACHE)
    ->setLimit("128M")      // max disk usage before purging old items
    ->setWritable(true);    // already default

Resource

The resource type is intended for storing plugins, extensions, resource packs and themes etc. It carries a bit of magic:

// This will actually unzip the plugin into the specified path
copy("test-plugin.zip", "plugins://test-plugin");

// This will remove the entire directory
unlink("plugins://test-plugin");