N
N
neyronius2011-03-16 15:53:06
PHP
neyronius, 2011-03-16 15:53:06

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

7 answer(s)
G
Gibbzy, 2011-03-16
@gibbzy

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

V
Voenniy, 2011-03-16
@Voenniy

Something no one remembered about redis :)
habrahabr.ru/blogs/webdev/76388/

Z
zizop, 2011-03-16
@zizop

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!

S
sadist007, 2011-03-16
@sadist007

File system. memcache. See what suits you best.

M
Max Kuznetsov, 2011-03-16
@pluseg

Maybe databases?

G
gaelpa, 2011-03-16
@gaelpa

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';

Too many "ifs" really.

A
Atrax, 2011-03-16
@Atrax

Why invent anything else?
What's wrong with a database?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question