PHP Class SizeRestrictedPackageCache

Inheritance: implements PackageCache
Afficher le fichier Open project: silverstripe/deploynaut

Protected Properties

Свойство Type Description
$baseDir
$cacheSize

Méthodes publiques

Méthode Description
getPackageFilename ( PackageGenerator $generator, string $identifier, string $sha, string $repositoryDir, DeploynautLogFile $log ) : string Return the filename of the generated package, retrieving from cache or generating as necessary
setBaseDir ( string $baseDir ) The base directory to store cached packages in.
setCacheSize ( integer $cacheSize ) Set the maximum number of items that will be stored in the package cache.

Méthodes protégées

Méthode Description
reduceDirSizeTo ( string $dir, integer $count, DeploynautLogFile $log ) Delete items in this directory until the number of items is <= $count.
sanitiseDirName ( string $identifier ) Take the identifier an make it safe to use as a directory name.

Method Details

getPackageFilename() public méthode

Return the filename of the generated package, retrieving from cache or generating as necessary
public getPackageFilename ( PackageGenerator $generator, string $identifier, string $sha, string $repositoryDir, DeploynautLogFile $log ) : string
$generator PackageGenerator The generator to use to create cache entries.
$identifier string A unique identifier for the generator; used to partition the cache
$sha string The SHA of the commit to be deployed
$repositoryDir string The directory where the repository resides
$log DeploynautLogFile The log to write status output to, including package-generation commands
Résultat string

reduceDirSizeTo() protected méthode

Delete the oldest files first.
protected reduceDirSizeTo ( string $dir, integer $count, DeploynautLogFile $log )
$dir string The directory to remove items from
$count integer The maximum number of .tar.gz files that can appear in that directory
$log DeploynautLogFile The log to send removal status messages to

sanitiseDirName() protected méthode

Take the identifier an make it safe to use as a directory name.
protected sanitiseDirName ( string $identifier )
$identifier string The unsanitised directory name.

setBaseDir() public méthode

The files will be stored in a subdirectory named after the identifier. If base directory isn't set, the getPackageFilename() won't run.
public setBaseDir ( string $baseDir )
$baseDir string The base directory

setCacheSize() public méthode

If null, items will never be deleted. If set, cache entries will be touched whenever they are accessed, and the least-recently-access items will be deleted.
public setCacheSize ( integer $cacheSize )
$cacheSize integer the number of package files to keep.

Property Details

$baseDir protected_oe property

protected $baseDir

$cacheSize protected_oe property

protected $cacheSize