$tableName
$tableName :
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"
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.
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 1 if successful creation, 0 otherwise.
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
$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 |
the autogenerated ressource identifier