Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
feat: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
raminjafary committed Dec 26, 2021
1 parent 199cab1 commit a8d4474
Show file tree
Hide file tree
Showing 6 changed files with 1,434 additions and 1,299 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
'no-console': 0,
'no-template-curly-in-string': 0,
'no-dupe-class-members': 0,
'import/order': 0
'import/order': 0,
'vue/multi-word-component-names': 0
}
}
3 changes: 1 addition & 2 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ module.exports = function Cache (moduleOptions) {
return
}

let redis;
let redis

if (!process.argv.includes('build')) {

redis = new RedisCache(options)

this.options.render.bundleRenderer.cache = redis
Expand Down
7 changes: 2 additions & 5 deletions lib/plugins/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ export class RedisCache {
}

set (key, value, ttl) {

const keyLocal = (this.prefix ? `${this.prefix}:` : '') + key + (this.hash ? `:${this.hash}` : '')

this.redis.set(keyLocal, key.indexOf('/') === -1 ? serialize(value) : value, (err, result) => {
this.redis.set(keyLocal, !key.includes('/') ? serialize(value) : value, (err, result) => {
if (err) {
logger.warn(err)
} else {
Expand All @@ -50,20 +49,18 @@ export class RedisCache {
}

async get (key, callback) {

const keyLocal = (this.prefix ? `${this.prefix}:` : '') + key + (this.hash ? `:${this.hash}` : '')

return this.redis.get(keyLocal, (err, result) => {
if (err) {
logger.warn(err)
} else {
callback(key.indexOf('/') === -1 ? deserialize(result) : result)
callback(!key.includes('/') ? deserialize(result) : result)
}
})
}

has (key, callback) {

const keyLocal = (this.prefix ? `${this.prefix}:` : '') + key + (this.hash ? `:${this.hash}` : '')

this.redis.exists(keyLocal, (err, result) => {
Expand Down
9 changes: 3 additions & 6 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,15 @@ export function shouldCache (match, patternsList) {
})
}

export function customTTL(match, patternsList) {

export function customTTL (match, patternsList) {
let ttl = 0

patternsList.some((pattern) => {

let some = false;
let some = false

if (pattern[0] instanceof RegExp) {
some = pattern[0].test(match)
}
else {
} else {
some = match.startsWith(pattern[0])
}

Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"lib"
],
"scripts": {
"prepare": "husky install",
"dev": "nuxt example",
"lint": "eslint --ext .ts,.js,.vue .",
"lint:fix": "yarn lint --fix",
Expand All @@ -25,17 +26,17 @@
"access": "public"
},
"devDependencies": {
"@commitlint/cli": "^14.0.0",
"@commitlint/config-conventional": "^14.0.0",
"@nuxtjs/eslint-config": "^7.0.0",
"@commitlint/cli": "^16.0.0",
"@commitlint/config-conventional": "^16.0.0",
"@nuxtjs/eslint-config": "^8.0.0",
"consola": "^2.15.3",
"eslint": "^8.0.1",
"eslint": "^8.5.0",
"husky": "^7.0.4",
"lint-staged": "^11.2.3",
"nuxt-edge": "^2.16.0-27226092.034b9901",
"lint-staged": "^12.1.4",
"nuxt-edge": "^2.16.0-27341297.777a4b7f",
"standard-version": "^9.3.2"
},
"dependencies": {
"ioredis": "^4.28.0"
"ioredis": "^4.28.2"
}
}
Loading

0 comments on commit a8d4474

Please sign in to comment.