构建使用 Twitter 数据的网站:缓存最佳实践?
我正在开发一个利用 Twitter 数据的应用程序。它将推文与用户创建的实体相关联,并允许其他访问者在实体页面上发推文,同时将该推文与实体相关联。
我的第一个想法是创建一个本地存储,其中包含与实体相关的特定搜索短语匹配的所有推文,通过用户将它们关联起来......
这工作得很好,除了当用户从时间线中删除他们的推文时会发生什么?它仍然会出现在实体页面上,因为我正在使用本地推文缓存...
处理一组持续的 Twitter 数据的最佳实践是什么?我不需要将其积压一年或任何时间,但我确实想确保它缓存的时间足够长以使其有用,同时仍与实际时间线同步(以防推文被删除)
I'm developing an application that makes use of twitter data. It will associate tweets with entities created by the users, as well as allow other visitors to tweet on the entity page, associating that tweet with the entity as well.
My first thought was to create a local store of all tweets matching a particular search phrase that relate to the entities, associating them via the user...
This works fine, except what happens when a user deletes their tweet from their timeline? it will still be present on the entity page because I'm using my local cache of tweets...
What is the best practice for working with an ongoing set of twitter data? I don't need to backlog it for say a year or anything, but I do want to make sure it's cached long enough to be useful, while still syncing with their actual timeline (in case tweets are deleted)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以经常清除缓存。我最近一直在研究同样的问题,但找不到任何好的信息。
我只是要提取与缓存匹配的时间段内的完整推文信息,并检查缓存中是否存在 api 结果中没有的推文。然后从缓存中删除它们。我可能会将其设置为每个用户每天执行一次。
You could purge your cache every so often. I've been working on this same problem lately and I can't find any good information on it.
I'm just going to pull down full tweet information for the time period matching my cache and check to see if there are any tweets existing in my cache that aren't in the api results. Then remove those from the cache. I'll probably set it to be done once a day per user.