I am a website designer, and I design both sites and applications for the web. I use PHP.
I often find I have to store information, which needs to be accessed by the user after the browser is closed.
Up until now I have always used a database (MySQL to be precise) to store information, however sometimes, I feel that I am storing information that does not warrant databas开发者_运维百科e storage, mainly because the database does not travel with the application - it needs to be created separately.
Are there any other options for storing small amounts of data? Something simpler perhaps?
You could deploy a properties file or an XML file with the app to store things you don't feel are appropriate to a database.
http://www.sqlite.org/
It's still a database, just within a file. No(t much) setup required.
Database is perfectly fine if you can differentiate users. Other storage mechanisms include cookies and Google Gears and ersatzdatabases like XML or plain-text files.
I know that you are using PHP, but some Web application frameworks for other languages such as Happstack (for Haskell) use an internal RAM based data storage serialized on the disk.
Happstack's RAM cloud database architecture provides you the speed and predictability of RAM based queries combined with the durability, replication, and ACID properties of traditional databases.
If you are interested, you can study the approach, I bet there are others.
精彩评论