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

@juangura19/ngx-cache

v1.0.1

Published

Esta libreria permite la gestion de cache sobre el navegador. intercepta las peticiones GET y base a una lista de servicios (apis) las va almacenando en la cache con tiempo de caducidad. adicional si no se desea hacer uso del interceptor puedes usar los m

Downloads

1

Readme

@juangura19/ngx-cache

Esta libreria permite la gestion de cache sobre el navegador. intercepta las peticiones GET y base a una lista de servicios (apis) las va almacenando en la cache con tiempo de caducidad. adicional si no se desea hacer uso del interceptor puedes usar los metodos para gestionar tu cache.

Install

  npm install @juangura19/ngx-cache

Input

| parameter | type | description | example | | :-------- | :------- | :------- | :------- | | base | string | url base de servicio | https://example.com | | path | string | recurso | /example | | ttl | number | tiempo de vigencia del dato | 3600 | | type | NgxCacheEnum | tipo de almacenamiento en el storage, por defecto se almacena en el sessionstorage | NgxCacheEnum.sessionstorage |

Usage/Examples

import { NgxCacheModule, NgxCacheEnum } from '@juangura19/ngx-cache';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    ...,
    NgxCacheModule.forRoot([
      { base: 'https://example.com', path: "/example1", ttl: 3600, type: NgxCacheEnum.sessionstorage},
      { base: 'https://example.com', path: "/example2", ttl: 360, type: NgxCacheEnum.localstorage },
      { base: 'https://example.com', path: "/example3", ttl: 0, type: NgxCacheEnum.cookie  }
      { base: 'https://example.com', path: "/example4", ttl: 60 }
    ])
  ],
  providers: [
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Cache

almacenamiento para session storage y local storage

| Key | Value | Description | | :-------- | :------- | :------- | | https://example.com/example | "{...data...}" | Data almacenada | | https://example.com/example-cas | 1700201255139 | Fecha de creación en formato number |

almacenamiento cookie, si el ttl es 0, el valor se eliminara cuando se cierra el explorador

| Key | Value | Description | | :-------- | :------- | :------- | | https://example.com/example | "{...data...}" | Data almacenada |

Metodos adicionales

Si no desea usar hacer uso del interceptor, no es necesario importar el modulo y podrias hacer uso del los metodos que se pone a disposicion para el manejo de cache.

| Metodo | input | descripcion | | :-------- | :------- | :------- | | find | key, ttl, type | permite obtener datos de la cache y valida si los datos estan vigentes en base al ttl enviado, el ttl no aplica para el almacenamiento en cookie | | save | key, data, type, ttl | permite guardar los datos en cache, el ttl solo es para almacenamiento en cookie | | remove | key, type | permite remover los datos de cache incluido su ttl |

import { NgxCacheService, NgxCacheEnum } from '@juangura19/ngx-cache';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent {

  constructor(
    ...,
    private readonly ngxCacheService:NgxCacheService
    ...
  ) {}

  remove = () => {
    //el tipo de almancenamiento es opcional, por defecto va apuntar al sessionstorage
    this.ngxCacheService.remove('https://example.com/example', NgxCacheEnum.localstorage)
  }

  save = () => {
    //el tipo de almancenamiento es opcional, por defecto va apuntar al sessionstorage, el ttl solo se envia cuando el almacenamiento es en cookie, por defecto es "0"
    this.cacheService.save('https://example.com/example', {...data...}, NgxCacheEnum.localstorage)
  }

  find = () => {
    //el tipo de almancenamiento es opcional, por defecto va apuntar al sessionstorage
    this.cacheService.find('https://example.com/example',100, NgxCacheEnum.localstorage)
  }
}

Authors