Phpxforms documentation

FileCacheStorage
in package

File cache storage

Tags
author

DaVee

version
0.87dev
license

Lesser General Public License 2.1 or later; see http://www.gnu.org/licenses/lgpl-2.1.html

Table of Contents

Properties

$file  : string
$pause  : int
$reset  : string|null

Methods

__construct()  : mixed
append()  : void
Append content to cache file
delete()  : void
Delete cache file
isValid()  : bool
Is cache file still valid
read()  : string|null
Get cache content
write()  : void
Write content into cache file
isWritable()  : bool
Can be cache file edited
keepCache()  : bool
Should reset cache
getLock()  : bool
Lock file
getResource()  : resource
Try to get a file pointer resource

Properties

$pause

private int $pause

Keep cache longer than it should e.g. rebuild cache max once per minute

$reset

private string|null $reset

Force reset every nth minutes/hour/day/month (i/h/d/m) (no inner conversion !!!)

Methods

__construct()

public __construct(string $file[, string|null $reset = null ][, int $pause = 0 ]) : mixed
Parameters
$file : string
$reset : string|null = null
$pause : int = 0
Tags
throws
InvalidArgumentException

Can not write cache file

append()

Append content to cache file

public append(string $content) : void
Parameters
$content : string

isValid()

Is cache file still valid

public isValid(DateTime $last) : bool
Parameters
$last : DateTime
Return values
bool

read()

Get cache content

public read() : string|null
Return values
string|null

write()

Write content into cache file

public write(string $content) : void
Parameters
$content : string

isWritable()

Can be cache file edited

protected isWritable([bool $retry = true ]) : bool
Parameters
$retry : bool = true
Return values
bool

keepCache()

Should reset cache

protected keepCache(DateTime $cached) : bool
Parameters
$cached : DateTime
Tags
throws
InvalidArgumentException

bad settings

Return values
bool

getLock()

Lock file

private getLock(resource $fp, int $mode, int $sleep) : bool
Parameters
$fp : resource
$mode : int
$sleep : int
Return values
bool

getResource()

Try to get a file pointer resource

private getResource(string $file, string $mode[, int $attempts = 0 ]) : resource
Parameters
$file : string
$mode : string
$attempts : int = 0
Tags
throws
InvalidArgumentException
Return values
resource

        
On this page

Search results