npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mocc-storage

v0.1.2

Published

web前端设置缓存,自检缓存是否过期,与使用web缓存器方法一致

Downloads

3

Readme

mocc-storage

前端本地缓存库,支持本地缓存过期时间设置

class MoccWebStorage {
    private storage;
    private storageOptions;
    private usingKeyCase;
    constructor(options: StorageOptions);
    /**
     * 使用中的缓存key
     */
    get usingKeys(): string[];
    /**
     * 初始化
     */
    private init;
    /**
     * 自检清理过期缓存
     * @description 初始化时,会自检一次,如在某些场景需要可手动调用该方法自检
     * @returns needCleanKeys 清理的缓存key
     *
     */
    checkCleanSelf(): string[];
    /**
     * 处理包装缓存key
     * @param key 缓存key
     * @returns 包装缓存key
     */
    private processKey;
    /**
     * 处理包装缓存数据
     * @param data 缓存数据
     * @param options 缓存配置
     * @returns 包装缓存数据
     */
    private processValue;
    /**
     * 获取缓存数据
     * @param key 缓存key
     * @description 在获取的同时会校验缓存是否过期,过期数据会移除,反之返回数据
     * @returns 缓存数据
     */
    getItem(key: string): any;
    /**
     * 设置缓存数据
     * @param key 缓存key
     * @param value 缓存数据
     * @param options 缓存配置
     * @returns 设置是否成功
     */
    setItem(key: string, value: any, options: Options = {}): boolean;
    /**
     * 移除缓存数据
     * @param key 缓存key
     * @returns 移除是否成功
     */
    removeItem(key: string): boolean;
    /**
     * 清理缓存
     * @param isCleanAll 是否清理应用缓存器所有数据,而非当前实例缓存器
     * @returns 清理是否成功
     */
    clear(isCleanAll?: boolean): boolean;
}