\rid

Ressource ID storage acts as a global memory for MindFlow and websites.

Ressource ID storage enables the programmer to store arbitrary content either in the session or in the database, and specify an expiration interval. Each content has an 'rid' which is a unique key that allows accessing the content. If the content is stored in the session, it can last at most the session duration. But if it is stored in the database, then it can last forever. Specifying an expiry date allows you to store some content and forget it. It will be automatically deleted when the expiration delay will be met. If the value is expired, the get function will return null, so you must always check the returned value against null. Do not forget to call cron.php in your website hosting environment, as it is required to launch the cleanup on a regular basis.

Sample usage : Put the value "test1" into the database with rid 'mytest1' and make it expire after 1 minute rid::put("test","db",'PT1M','mytest1');

Now read our value echo "value=".rid::get('mytest1'); //before 1 minute delay, outputs "value=test" //after 1 minute delay, outputs "value="

It is not mandatory to assign an rid. You can let the class decide one for you by not specifying any when calling the put() function, then reuse it. The rid value is returned when executing function put()

$myRid = rid::put("test2","session",'PT1M'); echo "value=".rid::get($myRid); //before 1 minute delay, outputs "value=test2"

Summary

Methods
Properties
Constants
getTableName()
importInitializationData()
createSQLTable()
importSQLDump()
getClassName()
put()
get()
cleanup()
cleanAll()
$tableName
$oneTablePerLocale
$createTableSQL
$createTableKeysSQL
$enableImportInitializationData
$enableHistory
$reloadFormOnSave
$baseTableSQL
$baseTableKeysSQL
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$tableName

$tableName : 

Type

$oneTablePerLocale

$oneTablePerLocale : 

Type

$createTableSQL

$createTableSQL : 

Type

$createTableKeysSQL

$createTableKeysSQL : 

Type

$enableImportInitializationData

$enableImportInitializationData : 

Type

$enableHistory

$enableHistory : 

Type

$reloadFormOnSave

$reloadFormOnSave : 

Type

$baseTableSQL

$baseTableSQL : 

Type

$baseTableKeysSQL

$baseTableKeysSQL : 

Type

Methods

getTableName()

getTableName() 

importInitializationData()

importInitializationData(  $html = array()) 

Performs the SQL requests required to define basic data for the current table / record

Parameters

$html

createSQLTable()

createSQLTable(integer  $showSQL,   $html = array(), boolean  $importInitializationData = false) : integer

Creates the SQL table for this record in the database.

If you have set $oneTablePerLocale to true, the function will only create the table for the currently defined locale. If you want to create different tables for different locales, you will have to alter the locale value in $mf->info['data_editing_locale'] prior creating a table for the desired locale.

Parameters

integer $showSQL

generate HTML showing the result of the SQL request and feed the $html array passed by reference with it

$html
boolean $importInitializationData

Fill the table with initialization data after creation if this data is available

Returns

integer —

returns 1 if successful creation, 0 otherwise.

importSQLDump()

importSQLDump(  $filepath,   $showSQL,   $html = array()) 

Import a given SQL dump

Parameters

$filepath

absolute file path

$showSQL
$html

getClassName()

getClassName() 

put()

put(  $content,   $type,   $expiration,   $userRid = null) : string

Puts a ressource in memory (session or database). If you want to store a value permanently, use database

Parameters

$content

whatever variable you want to store

$type

string 'session' or 'db' in order to store the ressource where due.

$expiration
$userRid

string A user defined unique identifier

Returns

string —

the autogenerated ressource identifier

get()

get(  $rid,   $delete = false) : \the

Returns the content matching the rid

Parameters

$rid

the rid associated with the content stored

$delete

boolean the rid entry will be deleted after the read operation if set to true

Returns

\the —

content stored or null if the value is expired

cleanup()

cleanup() 

Deletes expired records. Meant to be launched from a cron task

cleanAll()

cleanAll() 

Completely empties the ressource id storage : deletes all records, even if they are not expired.