Reputation: 821
How to save a variable at application level(same for all users) in php which will get updated after some time?
I've tried to find about it. I've found the following solutions:
2 is considered as best (AFAIK). (I'm not allowed to install anything on the Server)
What about other two (mentioned above) or any other options and how I can implement those? I'm bit concerned because traffic is moderately high (but the bad thing is that I still can't use any cache mechanism). We just need to save the contents of buffer of around 255 bytes at application level.
Any snippets, pointers or help of any sort would be highly appreciated.
Thanks.
Upvotes: 1
Views: 2371
Reputation: 40675
You need a permanent storage, not cache or something like that. If your application doesn't use a database already, there are several options you can choose from:
If your app uses a database already, why not store that data in a separate table?
Upvotes: 2
Reputation: 3243
If you do not have the option to use databases you can consider writing the data to a file on disk.
Upvotes: 0
Reputation: 21899
This is what databases are for. If you don't want to spend a lot of time setting up a large database application, try out sqlite.
Upvotes: 2
Reputation: 798456
Some caches (memcache in particular) are lossy, and most won't survive being restarted. Use a database.
Upvotes: 1