简体   繁体   English

我应该为该php / mysql xml生成api使用什么缓存策略/技术

[英]What caching strategy/technology should I use for this php/mysql xml generating api

I am developing a php/mysql based api that returns generated xml from executing multiple sql queries and then assembling the result sets into a single xml string/document. 我正在开发一个基于php / mysql的api,该api通过执行多个sql查询返回生成的xml,然后将结果集组合到单个xml字符串/文档中。

I will have multiple clients requesting various flavours of this api for example: 我将有多个客户端请求此API的各种样式,例如:

http://domain.com/api/ /playerbio/12345 would return a player's biography with various sections such as personal info, current ytd stats, career stats, list of injuries etc. http://domain.com/api/ / playerbio / 12345会返回球员的个人履历,其中包括个人信息,目前的年初至今数据,职业数据,伤病名单等各个部分。

this type of api request would be made by many clients every hour and for the various leagues, teams, rosters, players etc 每小时都会有许多客户针对各种联赛,球队,花名册,球员等发出这种类型的api请求

The statisticians and editors of the source database are managing this content continuously throughout the day. 源数据库的统计人员和编辑人员全天不断地管理此内容。

I currently have this api reading directly from the editors source database, pretty much guaranteeing that any xml document generated will be up to date. 我目前有这个api直接从编辑器的源数据库中读取,几乎可以保证所生成的任何xml文档都是最新的。

I am contemplating implementing a caching strategy to reduce the number of times the source database is queried as the average xml document requires 4-7 queries to gather all of the data for assembling. 我正在考虑实现一种缓存策略,以减少查询源数据库的次数,因为平均xml文档需要4-7个查询才能收集所有数据以进行组装。

I am looking for strategies and technologies here especially considering that this api will be called 300-500k times a day and the xml document size ranges from 20k to 100k. 我在这里寻找策略和技术,特别是考虑到该API每天将被调用300-500k次,并且xml文档大小范围从20k到100k。

I know there's APC, memcache, memcached, Redis, MongoDB and even creating a simple file based cache but I would like to hear from others what they have used in similar situations. 我知道这里有APC,memcache,memcached,Redis,MongoDB,甚至还创建了一个基于文件的简单缓存,但是我想听听其他人在类似情况下的使用情况。

I am a big fan of memcached - its fast, easy to use and has standard libraries for integration. 我是memcached的忠实拥护者-它快速,易于使用,并且具有用于集成的标准库。

memcached is extremely fast and can serve up lots of data, but it is not persistent, its a true cache, so expect to have a way to load data. memcached速度非常快,可以提供大量数据,但是它不是持久性的,而是真正的缓存,因此希望有一种加载数据的方法。 The auto-trimming of old keys is priceless. 自动修改旧键是无价的。

如果您想获得快速而持久的数据,则可以使用Redis,否则,MemcacheD将是您的替代选择,而不是持久性,但是如果您的应用程序在单个服务器上运行,那么APC将是理想选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM