- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在使用 Sails 向 Redis 添加一些数据...它工作正常,但我不确定如何为 key 设置 EXPIRE...
我正在为模型使用 sails-redis 适配器/连接...我的模型看起来像这样
module.exports = {
connection: 'cache',
attributes: {
id: {type: 'string', primaryKey: true},
data: {type: 'string'}
}
};
保存我使用的模型
Cache.create({id: "somekey", data: data}, function(err, data){})
最佳答案
据我所知,Waterline 不为当前附近的 native 适配器提供此功能。然而,这有点 hacky,但您可以通过 Waterline 访问 redis 客户端本身,并使用创建的模型 ID 来访问它。
// Create the base model
Model.create({ field: value }).exec( function ( err, created ) {
if ( created ) {
// Then manually set expiration via native Redis adapter
var native = Model.adapter.connections.connectionName._adapter.native;
native( 'connectionName', null, function ( err, connection ) {
if ( connection ) {
connection.expire('waterline:<model name, lower case>:id:' + created.id, <timeout, in seconds>, function ( err, reply ) {
console.log( err, reply );
});
}
});
}
});
不像我喜欢的那样干净,但我也不喜欢手动编写 Redis 本身内置的功能。
关于node.js - 如何使用 Sails 为 Redis 记录调用 EXPIRE 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26532708/
我的 Twilio 可编程视频控制台定期收到此警告。它似乎并没有影响我的视频 session ,但是因为,好吧,我有点强制症,我想知道如何让这个警告消失。 在房间进行时是否有规定的刷新 token 的
在 stackoverflow 中搜索后,我了解了如何使用 session 过期。感谢计算器! 代码是: session_start();// Starting Session // Storing
我正在尝试遵循 aws s3 cp 的 AWS 文档, 其中 documents the --expires flag作为: --expires (string) The date and time
我正在尝试缓存控制所有静态 css/js 文件。代码看起来像: @Override public void addResourceHandlers(ResourceHandlerRegis
我正在使用 Spring Security 3.0.2 基于表单的身份验证。但我不知道如何配置它,以便在 session 过期时请求不会重定向到其他页面(过期 url)或显示“ session 过期”
我对基于 token 的授权相当陌生。我正在尝试找出自定义过期/ token 刷新方案中的缺陷。 我在 Express API 中有一个基本的 JWT 身份验证设置;我将 JWT 过期时间设置为 1
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
在 android 应用程序中,当使用 DefaultHttpClient 获取 URL 内容(执行 HttpGet)时,我在日志中收到以下警告: W/ResponseProcessCookies(2
这与 DST Root CA X3 Expiration (September 2021) 有关 当在线搜索修复程序以应用于旧服务器(在我的情况下为 Debian 8)时,该服务器确实调用了使用 le
我很难弄明白这一点。我想在 paypal 中创建一个永远不会结束的月度订阅,除非用户取消它。每次订阅运行时,我都希望它调用我的 IPN url。 下面是我正在使用的: 请注意,我删除了 IPN ur
对于下面的 block ,生命周期'b和'c什么时候结束? use core::ops::Deref; #[derive(Debug)] struct A { child_b: &'b T,
我正在尝试为我的网站设置 cookie。我正在使用: ServletActionContext.getResponse().addCookie(); Cookie maxAge 设置为“2592000
我正在尝试编写一个 HOC,在一段时间后将其状态属性 visible 更改为 false。 这是我到目前为止所得到的: const withExpire = (WrappedComponent) =>
在我的 WordPress 网站上,我有数千个过期交易的帖子。它们都属于已存档类别。我正在寻找一个 Mysql 查询或 php 程序,它将在所有标题(存档帖子)前面插入字符串“EXPIRED”。我很感
我为 HTML 和 CSS 制作了一个日历,但我没有足够的 JS(或 jQuery),所以在一定时间后,日期会变得不活动。所有不活动的按钮(带日期)都有“过期”类,我有必要在每天过期后,将“过期”类添
我正在使用 tymondesigns/jwt-auth我的应用程序包,但一段时间后显示 token expired 消息。我已经设置了 'ttl' => null 并删除了 exp 但它没有用。 这是
我正在使用 axios 向 diro 发送请求使用端点 /user/create 创建用户. 但是,我不断收到这样的错误: Error response: { Error: certificate h
尝试使用 Mechanize 从 https asp 站点上抓取一些内容,看起来好像登录页面提交有效,因为我返回了 200。但是当我尝试打开一个可能使用登录后捕获的 cookie 的 url 时,我重
我正在使用以下命令创建 keystore : keytool -genkey -keystore myStore.keystore -keyalg RSA -keysize 1024 -alias m
使用这行代码时,我不断收到错误消息,我试图让 cookie“myCookie”在凌晨 12:00 过期。 但我不确定为什么我无法做到这一点。 这些是错误: 如果我用这个, Response.Cooki
我是一名优秀的程序员,十分优秀!