A better way to deal with this kind of thing is with a two-phase fetch. So
instead of directly caching an array of event data, instead cache an array
of event IDs. Query that list, then use it construct a list of the keys of
individual event objects you want to fetch, then multi-get that list of
keys.
In addition to greatly increasing the maximum size of the list (memcached
has a 1-megabyte hard limit on item size, and obviously you can fit a lot
more IDs than full data in that limit) you will also, if you're using
multiple memcached servers, spread the load around by virtue of your
multi-get hitting basically every server once your key list is a certain
size. If you stick all the data in one frequently-requested item, then you
will pound the particular server that happened to get that item while all
the others sit idle.
Another advantage of a scheme like this is that you can update an item's
data without having to read then write every list that contains that item.
Just update it by ID (like you'd do in your database queries) and all the
lists that contain it will magically get the correct information.
All the above said, it is true that dealing with lists of things is not
currently memcached's strong suit. For example, there is no "append"
operation. It is much better at caching individual objects.
-Steve
分享到:
相关推荐
memcache-collections 是 memcache 高速缓存系统中的产生并发式和分布式数据结构开发包。memcache 是一个高性能的分布式的内存对象缓存系统,通过在内存里维护一个统一的巨大的hash表,它能够用来存储各种格式的数据...
commons-collections-20040616.jar, commons-collections-3.2-osgi.jar, commons-collections-3.2-sources.jar, commons-collections-3.2.1.jar, commons-collections-3.2.2-javadoc.jar, commons-collections-3.2.2...
### Collections in iOS Development #### About Collections In the realm of iOS development, collections play a crucial role in organizing and managing data. The Apple documentation on collections ...
赠送jar包:commons-collections-3.2.2.jar; 赠送原API文档:commons-collections-3.2.2-javadoc.jar; 赠送源代码:commons-collections-3.2.2-sources.jar; 赠送Maven依赖信息文件:commons-collections-3.2.2....
在Java编程中,`collections4`和`collections15`可能指的是Apache Commons Collections库的不同版本。这个库是Apache软件基金会提供的一个强大且实用的集合框架扩展,它为Java的内置集合类提供了更多的功能和优化。...
Apache Commons Collections是一个Java库,它提供了大量的集合框架增强功能,扩展了Java标准库中的集合类。这个库在Java开发中非常实用,因为它包含了各种高效、功能丰富的数据结构和算法,可以显著提高代码的效率和...
赠送jar包:commons-collections4-4.1.jar; 赠送原API文档:commons-collections4-4.1-javadoc.jar; 赠送源代码:commons-collections4-4.1-sources.jar; 赠送Maven依赖信息文件:commons-collections4-4.1.pom;...
Apache Commons Collections是一个Java库,包含了丰富的集合操作工具和算法,为Java平台的开发提供了大量的实用类和接口。这个"commons-collections-3.2.2-"版本是该库的一个特定发行版,主要用于解决WebLogic服务器...
赠送jar包:commons-collections4-4.4.jar; 赠送原API文档:commons-collections4-4.4-javadoc.jar; 赠送源代码:commons-collections4-4.4-sources.jar; 赠送Maven依赖信息文件:commons-collections4-4.4.pom;...
《Apache Commons Collections 4.1在Java中处理Excel2007文件的解决方案》 Apache Commons Collections库是Java开发中的一个强大工具,它提供了一系列高效、实用的数据结构和算法。在处理Excel2007(.xlsx)文件时...
《Apache Commons Collections 3.2.1:Java集合框架的强大扩展》 Apache Commons Collections是Apache软件基金会的一个项目,它提供了一系列强大的、用于处理Java集合框架的工具类和算法。在这个项目中,`commons-...
该文件里包含两个.jar包: collections-generic-4.01.jar和looks-2.1.4.jar, 引入collections-generic-4.01.jar: 右击工程--》Build path ——》Add External JAR-->选中collections-generic-4.01.jar --》OK 在源...
标签:apache-collections-commons-collections-3.1.jar.zip,apache,collections,commons,collections,3.1,jar.zip包下载,依赖包
赠送jar包:commons-collections4-4.4.jar; 赠送原API文档:commons-collections4-4.4-javadoc.jar; 赠送源代码:commons-collections4-4.4-sources.jar; 赠送Maven依赖信息文件:commons-collections4-4.4.pom;...
赠送jar包:commons-collections-3.2.2.jar; 赠送原API文档:commons-collections-3.2.2-javadoc.jar; 赠送源代码:commons-collections-3.2.2-sources.jar; 赠送Maven依赖信息文件:commons-collections-3.2.2....
commons-collections-3.2
《Apache Commons Collections 3.2.2:Java开发的强大工具》 Apache Commons Collections,简称Collections,是Apache软件基金会提供的一款开源Java库,它为Java集合框架提供了大量的实用工具类和扩展功能。在Java...
赠送jar包:commons-collections-3.2.1.jar; 赠送原API文档:commons-collections-3.2.1-javadoc.jar; 赠送源代码:commons-collections-3.2.1-sources.jar; 包含翻译后的API文档:commons-collections-3.2.1-...
2. **Apache Commons Collections** - `commons-collections-3.2.2.jar` 这个库扩展了Java集合框架,提供了许多额外的数据结构和算法。它包含: - 高级集合实现:如双向队列、堆栈、映射、多重集(Multiset)等。 ...