简体   繁体   English

限制记忆快取储存空间的大小

[英]Limiting the size of memcache storage

I am using the FUSE file system fuse.py and plan to use memcache to store the files. 我正在使用FUSE文件系统fuse.py,并计划使用内存缓存来存储文件。 I want to have a small amount of memcache space so that I know what files are being stored and what files are being replaced. 我希望有少量的内存缓存空间,以便知道要存储的文件和要替换的文件。

I understand that Memcache has slabs which stores data of that particular size. 据我了解,Memcache具有存储该特定大小的数据的平板。 But is it possible to have only one slab? 但是,可能只有一个平板吗? For example have one slab of 5mb, with each page size 1mb so that I can store maximum of 5 files. 例如,有一个5mb的平板,每个页面大小为1mb,这样我最多可以存储5个文件。 And if I need to add the 6th one the LRU policy will remove a file and make space for it. 如果我需要添加第六个,LRU策略将删除一个文件并为其留出空间。

Basically I want to use memcache as a cache for files and once a file is removed from memcache, store the change in db server. 基本上,我想将memcache用作文件的缓存,一旦从memcache中删除了文件,就将更改存储在db服务器中。

Don't make assumptions on the implementation of a system based on how this or other systems might be implemented; 不要在系统的基础上如何或其他系统可能实现的实施做出假设, the only thing you can rely on is what's in the published API documentation, and in this case, Google App Engine does not provide a callback when entries expire (which will either expire when the entry reaches its TTL or is replaced due to LRU), nor does it back them up to other storage systems. 您唯一可以依靠的就是已发布的API文档中的内容,在这种情况下,Google App Engine不会在条目过期时提供回调(该回调将在条目达到其TTL时过期,或者由于LRU而被替换),也不会将它们备份到其他存储系统。

You shouldn't use memcache for durable storage such as a file system; 您不应该将Memcache用于文件系统之类的持久存储。 please consider one of the following systems instead for durable storage: 请考虑使用以下系统之一代替持久存储:

You can, of course, cache their data in Memcache, but since it can expire, you should store the originals in a more durable storage system, and cache the frequently-accessed chunks/files/metadata in Memcache. 您当然可以将其数据缓存在Memcache中,但是由于它们可能过期,因此您应该将原始数据存储在更耐用的存储系统中,并将经常访问的块/文件/元数据缓存在Memcache中。

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

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