
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
cesium-cache
Advanced tools
Cesium 缓存
通过 重写 Cesium.Resource._Implementations.loadWithXhr 方法(此方法在 Cesium.Resource 的类型下未定义)
依赖库
dexiecesium在使用前需要 安装 dexie
npm i dexie cesium-cache
# yarn add dexie cesium-cache
# pnpm add dexie cesium-cache
此插件会覆盖 Cesium.Resource._Implementations.loadWithXhr 方法,由于项目引入 cesium 的方式不同 为解决这个问题,提供了第二个参数,用于传递 Resource 对象
在 main.js 或者 app.vue 添加如下代码
import { useCesiumCache } from 'cesium-cache'
useCesiumCache()
在 main.js 或者 app.vue 添加如下代码
import * as Cesium from 'cesium'
import { useCesiumCache } from 'cesium-cache'
useCesiumCache({}, Cesium.Resource)
类型定义如下:
type ResponseType = 'arraybuffer' | 'blob';
interface CacheConfig {
dbName?: string;
key?: (
url: string,
responseType: string,
method: 'GET' | 'POST',
data: object | undefined,
headers: object | undefined
) => string;
types?: Array<ResponseType>;
}
type Resource = typeof window.Cesium.Resource;
export declare const useCesiumCache: (config?: CacheConfig, Resource?: Resource) => {
clear(): void;
getCacheSize(): Promise<string>;
};
缓存配置
LocalStore注意 key 与 types 配置项,将同时起作用,及 key 的结果不为空字符串时,且该请求返回值类型在 types 中 才会对结果进行缓存
Resource
Cesium.Resource 默认为 window 下的 Cesium.Resource 对象 ,若 使用 npm 方式引入 cesium 则需要传递example
import { useCesiumCache } from 'cesium-cache'
useCesiumCache({
dbName: 'cesium-cache',
types: ['arraybuffer', 'blob'],
})
clear => Promise 清除所有缓存
getCacheSize => Promise 获取已经占用的缓存大小
example
import { useCesiumCache } from 'cesium-cache'
const cache = useCesiumCache({
dbName: 'cesium-cache',
types: ['arraybuffer', 'blob'],
})
cache.getCacheSize().then((size) => {
console.log(size)
})
cache.clear()
MIT
FAQs
Cesium cache plugin
We found that cesium-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.