You need to save a value for a long time and do not want to write it into the database.

Source: Internet
Author: User
I am working on a lottery system. I have 1 First Prize, 10 second prize, and 100 third prize. now I need to save some of the prize winners to see if there are enough prize winners, but it's a little tricky to write it into the database. how do you store it. I am working on a lottery system. I have 1 First Prize, 10 second prize, and 100 third prize. now I need to save some of the prize winners to see if there are enough prize winners, but it's a little tricky to write it into the database. how do you store it.

Reply content:

I am working on a lottery system. I have 1 First Prize, 10 second prize, and 100 third prize. now I need to save some of the prize winners to see if there are enough prize winners, but it's a little tricky to write it into the database. how do you store it.

Files exist. In fact, databases also store files.

Put the file in it. this temporary storage of data is not a file or a cache, but redis is also good. it comes with sorting.

Front-end localStorage

Put it in the cache. redis

File_put_content: Save the file

For configuration, write the configuration.

Write an XML file to save

If you do not want to store databases, you can store files, shared memory (such as shared memory functions, apc, apcu), memcached, redis, and so on.
However, there is a risk of loss. if you don't want to lose the number of winners, you 'd better put it in the database, and data loss will be more troublesome.

It can be stored in the redis Cache.

Stored in a file, written to the cache, or written to the configuration file

This is not too much data! Since it is useful, it is still possible to collect statistics and view data on a certain day of a certain year, and it is quite good to store the database!

Isn't sqlite solve this problem?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.