How to implement a random recommendation on a per-person basis and not repeat the recommended

Source: Internet
Author: User
Keywords Php mysql redis
Tags redis server
System recommendation algorithm:
According to each person's rules, need to carry out random recommendation, and each recommendation is different, how to achieve?
Redis, MySQL?

Reply content:

System recommendation algorithm:
According to each person's rules, need to carry out random recommendation, and each recommendation is different, how to achieve?
Redis, MySQL?

It is recommended to use the Redis implementation to mark the recommended items with a hash type of key-value, and the next recommendation results are compared in Redis and are not recommended for adoption and tagging.

Hash performance is much higher than SQL retrieval, so choose Redis, request time can be reduced to Ms single-digit, deployed to a dedicated Redis server, can not occupy the MySQL load, the best choice.

Of course Redis preferred

Not clear about your specific usage scenarios, suggest a way to use
You can use the collection of Redis to randomly fetch your recommendation from the collection.
Then remove the data from the collection to protect it from repeated recommendations.

If it's not a huge amount of data, you can design a structure to achieve the functionality you need:
A referrer and a table of recommended relationships,
Need something: referrer, referral ID

Random recommendation is not a problem, make an algorithm (find the Order by rand () replacement algorithm) to find out to satisfy the recommendation of the number of bars-nothing more than the previous recommendation (there is already a table record).

So you just need to record the last time you find a personal referral ID.

  • 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.