axios cache interceptor
v1.6.2
ใช้แพ็คเกจนี้? โปรดพิจารณาบริจาคเพื่อสนับสนุนงานโอเพ่นซอร์สของฉัน❤
ช่วยเพิ่มความเป็น axios-cache-interceptor! แสดงและแบ่งปันที่เก็บที่น่าทึ่งนี้กับเพื่อนและเพื่อนร่วมงานของคุณ!
Cache Interceptor สำหรับ Axios ที่ทำจากนักพัฒนาและประสิทธิภาพในใจ
Axios Cache Interceptor เป็นชื่อที่บอกว่า Interceptor สำหรับ Axios เพื่อจัดการแคช มันถูกสร้างขึ้นเพื่อช่วยให้นักพัฒนาโทรหา Axios หลายครั้งโดยไม่ต้องกังวลเกี่ยวกับการโอเวอร์โหลดเครือข่ายหรือเขียนโค้ดตัวเองเป็นระบบแคชที่เรียบง่ายและบั๊กกี้
อ่านเอกสารเพื่อ เรียนรู้เพิ่มเติม
import Axios from 'axios' ;
import { setupCache } from 'axios-cache-interceptor' ;
const instance = Axios . create ( ) ;
const axios = setupCache ( instance ) ;
const req1 = axios . get ( 'https://arthur.place/' ) ;
const req2 = axios . get ( 'https://arthur.place/' ) ;
const [ res1 , res2 ] = await Promise . all ( [ req1 , req2 ] ) ;
res1 . cached ; // false
res2 . cached ; // true ได้รับใบอนุญาตภายใต้ MIT ดู LICENSE สำหรับข้อมูลเพิ่มเติม