开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 5.1K

浩文Willem/crmeb_java

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (1)
master
master
分支 (1)
master
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (1)
master
crmeb_java
/
app
/
utils
/
cache.js
crmeb_java
/
app
/
utils
/
cache.js
cache.js 2.76 KB
一键复制 编辑 原始数据 按行查看 历史
张先生 提交于 2020年08月13日 16:12 +08:00 . 我们发布啦
import { EXPIRE } from '../config/app';
class Cache {
constructor(handler) {
this.cacheSetHandler = uni.setStorageSync;
this.cacheGetHandler = uni.getStorageSync;
this.cacheClearHandler = uni.removeStorageSync;
this.cacheExpire = '_expire_2019_12_17_18_44';
}
/**
* 获取当前时间戳
*/
time()
{
return Math.round(new Date() / 1000);
}
/**
* 设置过期时间缓存
* @param {Object} key
* @param {Object} expire
*/
setExpireCahe(key,expire)
{
expire = expire !== undefined ? expire : EXPIRE;
if (expire) {
this.cacheSetHandler(key + this.cacheExpire,this.time() + expire)
}
}
/**
* 缓存是否过期,过期自动删除
* @param {Object} key
* @param {Object} $bool true = 删除,false = 不删除
*/
getExpireCahe(key,$bool)
{
try{
let time = this.cacheGetHandler(key + this.cacheExpire);
if (time) {
let newTime = parseInt(time);
if (time && time < this.time() && !Number.isNaN(newTime)) {
if ($bool === undefined || $bool === true) {
this.cacheClearHandler(key);
this.cacheClearHandler(key + this.cacheExpire);
}
return false;
} else
return true;
} else {
return !!this.cacheGetHandler(key);
}
}catch(e){
return false;
}
}
/**
* 设置缓存
* @param {Object} key
* @param {Object} data
*/
set(key,data,expire){
if(typeof data === 'object')
data = JSON.stringify(data);
try{
this.setExpireCahe(key,expire);
return this.cacheSetHandler(key,data);
}catch(e){
return false;
}
}
/**
* 检测缓存是否存在
* @param {Object} key
*/
has(key)
{
return this.getExpireCahe(key);
}
/**
* 获取缓存
* @param {Object} key
* @param {Object} $default
* @param {Object} expire
*/
get(key,$default,expire){
try{
let isBe = this.getExpireCahe(key);
let data = this.cacheGetHandler(key);
if (data && isBe) {
if (typeof $default === 'boolean')
return JSON.parse(data);
else
return data;
} else {
if (typeof $default === 'function') {
let value = $default();
this.set(key,value,expire);
return value;
} else {
this.set(key,$default,expire);
return $default;
}
}
}catch(e){
return null;
}
}
/**
* 删除缓存
* @param {Object} key
*/
clear(key)
{
try{
let cahceValue = this.cacheGetHandler(key + this.cacheExpire);
if(cahceValue)
this.cacheClearHandler(key + this.cacheExpire);
return this.cacheClearHandler(key);
}catch(e){
return false;
}
}
/**
* 清除过期缓存
*/
clearOverdue()
{
// let cacheList = uni.getStorageInfoSync(),that = this;
// if (typeof cacheList.keys === 'object'){
// cacheList.keys.forEach(item=>{
// that.getExpireCahe(item);
// })
// }
}
}
export default new Cache;
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

CRMEB商城JAVA版,SpringBoot + Maven + Swagger + Mybatis Plus + Redis + Uniapp +Vue 包含移动端、小程序、PC后台、Api接口;有产品、用户、购物车、订单、积分、优惠券、营销、余额、权限、角色、系统设置、组合数据、可拖拉拽的form表单等模块,大量的减少了二开的成本。
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/javaCodingEr_admin/crmeb_java.git
git@gitee.com:javaCodingEr_admin/crmeb_java.git
javaCodingEr_admin
crmeb_java
crmeb_java
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /