Answer the question
In order to leave comments, you need to log in
Creating a global registry in a PHP application?
On a site written in PHP, you need to save global data between sessions (numeric for now, but strings may be needed). One solution is to store the register in the database. What else can you think of about this?
Answer the question
In order to leave comments, you need to log in
I think that the singleton pattern + any singleton storage
so as not to accidentally change the values \u200b\u200bof 2 places at once
the storage - any
- database
-memcache
-files can somehow be cleverly stuffed into directories
-xml
-twitter )
The implementation can be peeped in Zend_Registry
Something no one remembered about redis :)
habrahabr.ru/blogs/webdev/76388/
It looks like you need a key-value store. If you don't want to bother with NoSQL databases, use the APC opcode cache ( apc_store / apc_fetch ).
We have already written about the singleton and Zend_Registry above. Good luck!
Take all persistent storage methods and sort through, checking for compliance with your criteria (which, by the way, are not specified).
If there are few values, rarely change, all are needed at once and an opcacher is installed, then
file_put_contents('registry.php','<?php '.var_export($registry));
include 'registry.php';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question