- 👋 Hi, I’m Tiantian He.
- 👀 In the past few years, I was interested in JAVA, I show great interesting in optimization now, however, not good at it.
- 📫 How to reach me: [email protected]
使用redis缓存实现文章的点赞功能,异步定时持久化到mysql
如题
1。 在进行点赞或取消点赞操作的时候,看见你用了同步操作,不知道这个是为了锁什么呢,为了保证整个操作的原子性吗,如果不锁会发生什么呢
2. 如果是分布式场景,需要对什么加锁呢,如果按照你这个synchronize的理解,同一时间只能有一个人点赞或取消赞,这么不太对吧
最近正在學習redis的應用
感謝分享這樣的內容
想請問一個問題
因為知道redis本身是單線程
想請問你這支程式裡面的 "synchronized"
是必要的嗎?
謝謝
为你这篇文章点赞
对于点赞功能设计,我还有个疑问
假设存在一个推荐系统,推荐系统根据文章的点赞数量进行排序,选出前10名作为 first page 推荐给用户。由于用户不停的点赞,所以这个排序结果也在不断的变化。
为了减轻服务器中排序所造成的计算压力和数据库读取压力。我的设想是 设计一层缓存,对文章进行堆排序。
你觉得这个想法怎么样?
请问 如果使用 redis 做这个排序,有什么业内都用的方案吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.