除了缓存存取策略还需要考虑过期策略

加入一个缓存除了考虑缓存是否最有效之外,缓存key策略是否完整,还需要考虑版本控制。也就是说,不仅仅要确保存取快,还要确保他能够快速失效。

这样,当某次构架调整上线,能够最快速度刷新缓存。
所以建议,将缓存的版本持久化,每次页面载入后端controller取版本库中的当前版本,如果过期则刷新版本重新读写缓存。

Ubuntu安装 APT-FAST

最近一年使用Ubuntu作为工作主力机,感觉还是很不错,Linux命令更为娴熟。不过依然许多东西还需要搜一下才会用,比如这种需要记忆repo地址命令

sudo add-apt-repository ppa:saiarcot895/myppa
sudo apt-get update
sudo apt-get -y install apt-fast

说说最近

1、博客挂了四个月刚恢复,失而复得真好。(以后再也不敢几年不备份…… 手工从rss恢复文章与发布日期好辛苦)

2、春节去了日本,自由行呆了12天。东京、镰仓呆了八天,大板呆了2天,京都呆了一天,回东京又呆了两天,非常棒。值得一提的是,感受到基友的日语功力以及满满的正能量(边读书边打工炒鸡努力)。

3、除夕那天早早起来去的镰仓,太美了。晚上去基友的基友家蹭了豪华年夜饭 …… 鲍鱼,大闸蟹,燕窝什么的 …… 总体来讲,日本去了一次还想去第二次,最近在谋划三年签证,希望顺利。

4、去年年初的计划全部完成。今年的计划正如我twitter说的,攒钱。

发几张图片出来:

Continue reading

Firefox caches hidden inputs

I have a hidden input field in my form. I noticed that if that field’s value is changed by javascript, and then the user refreshes the page, that same value will be set when the page reloads. From what I’ve seen, this only happens in Firefox.

I’ve solved this unwanted behaviour by adding autocomplete="off" to that hidden input, but W3Cdoesn’t like this solution, and if i validate the page I get the error:

Attribute autocomplete not allowed on element input at this point.

Apparently, the autocomplete attribute works only on specific inputs – see here.

So is there any solution that will satisfy both W3C and Firefox?

Continue reading