New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cache-api

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-api

cache data from display api.useful for working on the front end.

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

cache-api

cache data from display api.useful for working on the front end.

安装

npm install cache-api --save

使用

// 案例一

import CacheApi from 'cache-api';
import request from '@/utils/request'
export const getList = new CacheApi((data) => {
  request({
    url: 'user/list',
    method: 'get',
    data
  })
})
// .vue
import { getList } from '@/api/user'
const data = {
  current: 1,
  pageSize: 10,
}

getList.send(data).then(res => {

})

getList.forceSend(data).then(res => {

})

getList.send(data, true).then(res => {

})

// 案例二

import { createCacheAPI } from 'cache-api';
import request from '@/utils/request'
const getList = (data) => {
  request({
    url: 'user/list',
    method: 'get',
    data
  })
}
export const getListCache = createCacheAPI(getListRaw, {
  filters: [res => res],
})
// .vue
import { sendCacheAPI } from 'cache-api'
import { getList } from '@/api/user'
const data = {
  current: 1,
  pageSize: 10,
}

sendCacheAPI("getList")(data).then(res => {

})

sendCacheAPI(getList)(data).then(res => {

})

sendCacheAPI(getList, true)(data).then(res => {

})

许可证

ISC © yokasu

Keywords

cache

FAQs

Package last updated on 16 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts