Problem Description:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.ge...
分类:
其他好文 时间:
2014-07-07 16:41:12
阅读次数:
237
http://www.acmerblog.com/leetcode-lru-cache-lru-5745.htmlacm之家的讲解是在是好,丰富import java.util.LinkedHashMap;public class LRUCache { private int capacit...
分类:
编程语言 时间:
2014-07-07 15:32:24
阅读次数:
281
##**关于乱序**首先需要明确一个很普遍,但却未必人人都注意到的事实:程序并不总是按照源码中的顺序被执行的,此谓之乱序,乱序产生的原因可能有好几种:1. 编译器出于优化的目的,在编译阶段将源码的顺序进行交换。2. 程序执行期间,指令流水被 cpu 乱序执行。3. cache 的分层及刷新策略使得有...
分类:
编程语言 时间:
2014-07-07 14:46:35
阅读次数:
238
公司的图片服务器一直以来负载都比较高,原因是图片比较分散而且比较小。经常把iowait搞的特别的高。但是只有一台机器也法用squid,经测试squid和apache在同一台机器效果会很糟糕的。因为squid要写磁盘,Apache要读磁盘(本公司的情况是大量的随机读)。 经过测试,决定用lig...
分类:
其他好文 时间:
2014-07-01 20:53:05
阅读次数:
170
Shell命令行的书写规则 对Shell命令行基本功能的理解有助于编写更好的Shell程序,在执行Shell命令时多个命令可以在一个命令行上运行,但此时要使用分号(;)分隔命令,例如: [root@localhost root]# ls a* -l;free;df 长Shell命令行可以使用反斜线字...
分类:
其他好文 时间:
2014-07-01 19:36:37
阅读次数:
194
Buffer Cache 原理当一个进程需要访问数据时, 首先需要确定数据在内存中是否存在, 如果数据在Buffer中存在, 则需要根据数据的状态来判断是否可以直接访问还是需要构造一致性读取; 如果数据不在Buffer中, 则需要再Buffer Cache中寻找足够的空间来装载需要的数据, 如果Bu...
分类:
其他好文 时间:
2014-06-30 21:45:06
阅读次数:
283
这篇打算直接告诉大家怎么用吧,其实这个也不是很难的框架,大致使用过程如下:
// 获取缓存图片目录
File cacheDir = StorageUtils.getOwnCacheDirectory(activity,
"imageloader/Cache");
ImageLoaderConfiguration config = new ImageLoaderConfigur...
分类:
移动开发 时间:
2014-06-30 08:13:12
阅读次数:
289
Linux下Nginx的安装 如果出现:error: 'ngx_http_file_cache_node_t' has no member named 'length'异常,可能是ngx_cache_purge-2.1.tar.gz版本太旧导致...
分类:
系统相关 时间:
2014-06-30 00:11:43
阅读次数:
401
【题目】
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
se...
分类:
其他好文 时间:
2014-06-29 22:45:26
阅读次数:
358
http://www.ilsistemista.net/index.php/virtualization/43-kvm-scalability-and-consolidation-ratio-cache-none-vs-cache-writeback.html?limitstart=0 In the...
分类:
其他好文 时间:
2014-06-29 19:37:42
阅读次数:
265