Note that there are some explanatory texts on larger screens.

plurals
  1. POPersistent Objects in Wordpress/PHP
    primarykey
    data
    text
    <p>I would like to create a set of persistent objects that load their state from the database and are then persisted in memory for Wordpress/PHP page loads to use as cached memory objects. I would imagine an interface for these objects to include:</p> <ul> <li>initialise() - load state from database and perform any other initialisation functions needed prior to servicing requests</li> <li>getter_foo() - a series of getter methods for PHP code to call for memory cached responses</li> <li>getter_bar() - a series of getter methods for PHP code to call for memory cached responses</li> <li>update() - called by time or event driven processes that ask the object to go back to the database and refresh its state</li> </ul> <p>The two tricks I suspect are:</p> <ol> <li>Have the main PHP process alloc and hold the memory reference for these objects so that they remain pinned to memory across web transactions/requests without needing to reinitialise each time against the database</li> <li>Having a mechanism to allow the transactional processes to gain a pointer to this objects.</li> </ol> <p>Are there any examples of solutions that do this? I've been programming for years but am very new to both Wordpress and PHP so maybe this is quite straight forward. Not sure. In any event, I do recognise that technical solutions like <em>redis</em> and <em>memcached</em> might achieve similar goals but in a less elegant and non-contextual way. That said, if there's no easy way to do this I'm happy to use the 80/20 rule. :^)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload