I wanted to know what would be a good way for storing the information required by a something like a hit counter. I was wondering if this was possible using some session-like technique, but avail开发者_运维问答able to everyone. I am concerned about speed/performance, and not memory usage since the data to be store is minimal.
This is the sort of thing people use APC and/or memcached for.
Store it in a database!
If you app doesnt already use a DB you almost certainly have sqlite installed as part of your php installtion. Its about 10 lines of code to connect and read the value.
If you app already uses a db its one extra table with one extra column.
精彩评论