AbstractData
in package
AbstractYes
AbstractData
Abstract model for data access
Table of Contents
Properties
- $_last_cache : array<string|int, mixed>
- cache for the traffic limiter
Methods
- create() : bool
- Create a paste.
- createComment() : bool
- Create a comment in a paste.
- delete() : mixed
- Delete a paste and its discussion.
- exists() : bool
- Test if a paste exists.
- existsComment() : bool
- Test if a comment exists.
- getAllPastes() : array<string|int, mixed>
- Returns all paste ids
- getValue() : string
- Load a value.
- purge() : mixed
- Perform a purge of old pastes, at most the given batchsize is deleted.
- purgeValues() : void
- Purge outdated entries.
- read() : array<string|int, mixed>|false
- Read a paste.
- readComments() : array<string|int, mixed>
- Read all comments of paste.
- setValue() : bool
- Save a value.
- _getExpiredPastes() : array<string|int, mixed>
- Returns up to batch size number of paste ids that have expired
- getOpenSlot() : int|string
- Get next free slot for comment from postdate.
- upgradePreV1Format() : array<string|int, mixed>
- Upgrade pre-version 1 pastes with attachment to version 1 format.
Properties
$_last_cache
cache for the traffic limiter
protected
array<string|int, mixed>
$_last_cache
= array()
Tags
Methods
create()
Create a paste.
public
abstract create(string $pasteid, array<string|int, mixed> $paste) : bool
Parameters
- $pasteid : string
- $paste : array<string|int, mixed>
Tags
Return values
boolcreateComment()
Create a comment in a paste.
public
abstract createComment(string $pasteid, string $parentid, string $commentid, array<string|int, mixed> $comment) : bool
Parameters
- $pasteid : string
- $parentid : string
- $commentid : string
- $comment : array<string|int, mixed>
Tags
Return values
booldelete()
Delete a paste and its discussion.
public
abstract delete(string $pasteid) : mixed
Parameters
- $pasteid : string
Tags
exists()
Test if a paste exists.
public
abstract exists(string $pasteid) : bool
Parameters
- $pasteid : string
Tags
Return values
boolexistsComment()
Test if a comment exists.
public
abstract existsComment(string $pasteid, string $parentid, string $commentid) : bool
Parameters
- $pasteid : string
- $parentid : string
- $commentid : string
Tags
Return values
boolgetAllPastes()
Returns all paste ids
public
abstract getAllPastes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getValue()
Load a value.
public
abstract getValue(string $namespace[, string $key = '' ]) : string
Parameters
- $namespace : string
- $key : string = ''
Tags
Return values
stringpurge()
Perform a purge of old pastes, at most the given batchsize is deleted.
public
purge(int $batchsize) : mixed
Parameters
- $batchsize : int
Tags
purgeValues()
Purge outdated entries.
public
purgeValues(string $namespace, int $time) : void
Parameters
- $namespace : string
- $time : int
Tags
read()
Read a paste.
public
abstract read(string $pasteid) : array<string|int, mixed>|false
Parameters
- $pasteid : string
Tags
Return values
array<string|int, mixed>|falsereadComments()
Read all comments of paste.
public
abstract readComments(string $pasteid) : array<string|int, mixed>
Parameters
- $pasteid : string
Tags
Return values
array<string|int, mixed>setValue()
Save a value.
public
abstract setValue(string $value, string $namespace[, string $key = '' ]) : bool
Parameters
- $value : string
- $namespace : string
- $key : string = ''
Tags
Return values
bool_getExpiredPastes()
Returns up to batch size number of paste ids that have expired
protected
abstract _getExpiredPastes(int $batchsize) : array<string|int, mixed>
Parameters
- $batchsize : int
Tags
Return values
array<string|int, mixed>getOpenSlot()
Get next free slot for comment from postdate.
protected
getOpenSlot(array<string|int, mixed> &$comments, int|string $postdate) : int|string
Parameters
- $comments : array<string|int, mixed>
- $postdate : int|string
Tags
Return values
int|stringupgradePreV1Format()
Upgrade pre-version 1 pastes with attachment to version 1 format.
protected
static upgradePreV1Format(array<string|int, mixed> $paste) : array<string|int, mixed>
Parameters
- $paste : array<string|int, mixed>