Giter VIP home page Giter VIP logo

redis-delete-pattern's Introduction

redis-delete-pattern Build status

Delete a set of keys from a pattern in Redis

This was built to make removing a set of cached related items possible in one fell swoop.

Getting Started

Install the module with: npm install redis-delete-pattern

// Create a redis client
var redis = require('redis');
var redisDeletePattern = require('redis-delete-pattern');
var client = redis.createClient();

// Set up some data (pattern `model-{{id}}` in cache)
client.set('model-1234', 'hello');
client.set('model-5678', 'world');

// Fetch some data
client.get('model-1234', console.log); // null, 'hello'
client.get('model-5678', console.log); // null, 'world'

// Delete cached model data
redisDeletePattern({
  redis: redis,
  pattern: 'model-*'
}, function handleError (err) {
  // Fetch our keys but find nothing
  client.get('model-1234', console.log); // null, null
  client.get('model-5678', console.log); // null, null
});

Documentation

redis-delete-pattern presents redisDeletePattern as its module.exports.

redisDeletePattern(params, cb)

Function that deletes list of keys that match a pattern from Redis

  • params Object, container for parameters
    • redis Redis, instance of redis client to interact with
    • pattern String, pattern for redis to resolve keys via
      • Under the hood, this uses the KEYS command
  • cb Function, error-first, (err), callback function to handle errors
    • err Error|null, if there was an error, this will be it

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via grunt and test via npm test.

License

Copyright (c) 2014 Uber Technologies, Inc.

Licensed under the MIT license.

redis-delete-pattern's People

Contributors

twolfson avatar

Stargazers

niten2 avatar Maycon Mesquita avatar samma avatar Donncha Breen avatar Blake Niemyjski avatar Haoliang Yu avatar

Watchers

Danny Yuan avatar Jeff Wolski avatar Tony Cosentini avatar Ryan McKillen avatar Jason Lai avatar Chirayu Krishnappa avatar Caleb Mingle avatar Casper S. Jensen avatar  avatar Joshua T Corbin avatar  avatar Nico Belmonte avatar Eugene Yaroslavtsev avatar Ignas Mikalajūnas avatar Aiden Scandella avatar Phil Wang avatar  avatar Ben Metcalfe avatar  avatar Sunil Garg avatar Braden Allchin avatar Willem Spruijt avatar Andrii Yasinetsky avatar Jason Bowman avatar Brent Goldman avatar Kyle Ivey avatar Zheng Shao avatar Nick Rabinowitz avatar Charles Ma avatar Eskil Heyn Olsen avatar Pedram Keyani avatar Anthony Tran avatar Guillaume Guillaume avatar Hao Truong avatar Kevin Novak avatar Sam Marcellus avatar Daniel Chen avatar  avatar Steven Kish avatar  avatar  avatar  avatar  avatar Hilary avatar Justin Muller avatar David avatar Ryan Sokol avatar Kurt Spindler avatar hao yan avatar Sameer Sayed avatar Paweł avatar  avatar  avatar Dom Narducci avatar Vikas Gupta avatar  avatar Mingjie Lai avatar Dan Busch avatar  avatar  avatar Yixin Zhu avatar Esco Obong avatar Jeff Winner avatar  avatar Kevin Wang avatar Joakim Recht avatar Collin Greene avatar  avatar Haider Sabri avatar Jake Verbaten avatar  avatar Richard Tom avatar CHAD XU avatar Arun Nagarajan avatar Praveen avatar Brian Attwell avatar Martha Kelly Schumann avatar Amos Barreto avatar Anton Bulyonov (Bulyenov) avatar Margaret-Ann avatar jeff hu avatar Dustin Weatherford avatar Thomas Kielbus avatar Yifu Diao avatar Andreas Sæbjørnsen avatar Casey Lawler avatar Ashley avatar Will Hughes avatar  avatar Bryan Stitt avatar Ning Li avatar Chang Cheng avatar  avatar Xingzhong avatar Madan Thangavelu avatar Kevin Roth avatar David Hughes avatar Govind Kabra avatar Xiaochao Yang avatar  avatar

redis-delete-pattern's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.