Class MusicExtras::Cache
In: lib/musicextras/cache.rb
Parent: Object

Handles caching of data

Methods

Included Modules

Debuggable

Attributes

dir  [R]  Stores the directory where the caches are stored
greylist_file  [R] 

Public Class methods

dir
the directory to store cache data

Public Instance methods

Adds key to greylist. Use get_filename() to generate key

Removes entire cache dir

Removes the greylist file

Removes webcache dir

Returns the filename for a given key

key
The key to get the filename from
include_path
If true, will include full path to file. Defaults to true.

Handles greylist locking for the given block

block
Code that needs exclusive access to the greylist

Checks to see if a key is in the greylist

Loads data from the cache, returns the data or nil if it doesn’t exist

key
What to save the cache as. Should be a directory structure, but all non-word chars will be removed, except the /s. For example: Tom Petty/Free Fallin’ will be converted to TomPetty/FreeFallin

Remove key from greylist. Use get_filename() to generate key

Saves data in the cache, returning the file it was saved as

key
What to save the cache as. Should be a directory structure, but all non-word chars will be removed, except the /s. For example: Tom Petty/Free Fallin’ will be converted to TomPetty/FreeFallin
data
The data to store

Writes greylist to file

Reads the greylist from the greylist file or creates a new one

[Validate]