昨天,我发现这个很酷的脚本' memcache-top '很好地打印出memcached live的统计数据.看起来像,
memcache-top v0.6 (default port: 11211, color: on, refresh: 3 seconds)
INSTANCE USAGE HIT % CONN TIME EVICT/s READ/s WRITE/s
127.0.0.1:11211 88.8% 94.8% 20 0.8ms 9.0 311.3K 162.8K
AVERAGE: 88.8% 94.8% 20 0.8ms 9.0 311.3K 162.8K
TOTAL: 1.8GB/ 2.0GB 20 0.8ms 9.0 311.3K 162.8K
(ctrl-c to quit.)
Run Code Online (Sandbox Code Playgroud)
当你应该注意某些东西时,它甚至会使某些文字变成红色!
问:从广义上讲,您用来检查memcached设置得很好的一些有用的工具/技术是什么?
来自: http: //www.w3.org/TR/XMLHttpRequest/#the-setrequestheader-method
client.setRequestHeader()
Appends an header to the list of author request headers, or if
header is already in the list of author request headers, combines
its value with value.
Run Code Online (Sandbox Code Playgroud)
问:有没有一种方法可以只设置标头而不是附加到现有标头?
我正在使用的代码如下,基本上是从https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax复制和粘贴的:
jQuery(document).ajaxSend(function(event, xhr, settings) {
...
// xhr is an XMLHttpRequest object
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
Run Code Online (Sandbox Code Playgroud) 当我top
在 Macbook (BSD?) 上运行时,我几乎总是想按 CPU% 排序
它似乎是默认设置,所以我最终输入“o”(排序)并输入“cpu”并一直按回车键!
有没有办法让按 CPU% 排序成为默认值?
我想知道是否有人知道一种方便的方法或方法来确保你传递的钥匙django.core.cache.set()
或者没问题cache.get()
.
来自https://docs.djangoproject.com/en/1.3/topics/cache/#cache-key-warnings:
Memcached是最常用的生产缓存后端,它不允许超过250个字符的缓存键或包含空格或控制字符,并且使用此类键会导致异常.
我在md5_constructor()
这里找到了这个函数:https://github.com/django/django/blob/master/django/utils/hashcompat.py,
也许一种方法是md5-如果你总是使用的钥匙?不确定是否安全.
我像这样使用 ack:( ack-grep assets\\.
在 Ubuntu 上)
但是,我想排除不以“资产”开头的结果。例如:网站资产。
到目前为止,我已经尝试过ack-grep ^assets\\.
和其他随机的东西。
(在 Vim 正则表达式中,模式如下:\<assets\.
例如 :help \<)
基本上,这个命令通过所有子目录中的所有文件执行递归grep,我使用ALOT
但它很浪漫,需要一段时间才能打字
所以我想知道是否...而不是......
$ find . -type f -exec grep -l <some word here> {} \;;
Run Code Online (Sandbox Code Playgroud)
有一种方法可以在我的.bashrc中使用别名或其他东西,这样我就可以做类似......
$ findrecursive <some word here>
Run Code Online (Sandbox Code Playgroud) 原因是我有时会使用shell/interpreter作为计算器,并且几乎总是想要真正的除法,而且我已经厌倦了总是输入它!