小编Lou*_*hon的帖子

Python内存缓存,具有生存时间

我有多个线程运行相同的进程,需要能够相互通知在接下来的n秒内不应该处理某些事情,如果他们这样做的话,它不是世界末日.

我的目标是能够将字符串和TTL传递给缓存,并能够将缓存中的所有字符串作为列表获取.缓存可以存储在内存中,TTL不会超过20秒.

有没有人对如何实现这一点有任何建议?

python caching

18
推荐指数
10
解决办法
2万
查看次数

JQuery表单字符串长度验证

我有一些JQuery表单验证,其中我检查用户名的长度对于数据库来说不长,但它似乎返回真正的eveytime.

我错过了什么吗?

HTML

<form name="contact" method"post" action="">
<fieldset>

<label for="username" id="username_label" class="form_label">Username</label>
<input type="text" name="username" id="username" size="30" value="" class="text-input" />
<label class="error" for="username" id="username_error">This field is required.        </label>
<label class="error" for="username" id="username_length">Your Username should be less than 30 characters.</label>
<input type="submit" name="submit" class="button" id="submit_btn" value="Send" />
</fieldset>
</form>
Run Code Online (Sandbox Code Playgroud)

JavaScript的

$(function() {
$('.error').hide();
$(".button").click(function() {
  // validate and process form here

$('.error').hide();
  var username_length = $("input#username").val().length;
    if (username_length < 30) {
    $("label#username_length").show();
    $("input#username").focus();
    return false;
  }
}
Run Code Online (Sandbox Code Playgroud)

html forms jquery

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

caching ×1

forms ×1

html ×1

jquery ×1

python ×1