Giter VIP home page Giter VIP logo

redis-kit's Introduction

Vapor

Documentation Team Chat MIT License Continuous Integration Swift 5.6 Twitter


Vapor is an HTTP web framework for Swift. It provides a beautifully expressive and easy-to-use foundation for your next website, API, or cloud project.

Take a look at some of the awesome stuff created with Vapor.

💧 Community

Join the welcoming community of fellow Vapor developers on Discord.

🚀 Contributing

To contribute a feature or idea to Vapor, create an issue explaining your idea or bring it up on Discord.

If you find a bug, please create an issue.

If you find a security vulnerability, please contact [email protected] as soon as possible.

💛 Sponsors

Support Vapor's development by becoming a sponsor.

Broken Hands Transeo Emerge Tools Jari Donut Dane MacStadium

💚 Backers

Support Vapor's development by becoming a backer.

Moritz LangMaarten EngelsThomas KrajacicJesse TiptonSteve HumeMikkel UlstrupGeoffrey FosterPaul SchmiedmayerScott RobbinsSven A. SchmidtSpencer CurtisZach RausnitzTim „Timinator“ KretzschmarKlaasAndrew Edwards+Li, Inc.Stijn WillemsKyle NewsomeVia Aurelia SolutionsJakub KiermaszBrian DrellingMattes MohrJamieGalen RhodesLitmapsDavid RomanBrian StrobachJánosKishikawa KatsumiAlex SherbakovSidetrackGreg KarpatiFrantišek MikšJeremy GreenwoodMerch VisoiuRay FixMićo MiloložaJonas SannewaldTapEnvy.us, LLCJawadSentryPARAIPAN SORINKalyn DavisVinh Vo

redis-kit's People

Contributors

jaapwijnen avatar mordil avatar tanner0101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redis-kit's Issues

Support for Redis clusters

I have a Redis cluster on AWS elasticache and using request.redis.get in order to retrieve cached data results on MOVED <IP address> errors which are the way Redis tell its clients should ask other node about this key.
Does this client implementation supports Redis clusters, is it in the future directions?

Add Extensions for Codable

RedisNIO doesn't have a Codable API, but Vapor's Redis module @ 3.x does.

We'll want to migrate / re-add those APIs to this module before V4 ships.

Build fails with RediStack 1.0.0-beta.1

Since RediStack is imported like this, on a new deployment, it updated to the latest beta version, which does not compile.
.package(url: "https://gitlab.com/mordil/RediStack.git", from: "1.0.0-alpha.8"),

Workaround:
Add to main Package.swift:
.package(url: "https://gitlab.com/mordil/RediStack.git", .exact("1.0.0-alpha.10")),
unknown

Cache fetch fallbacks

extension KeyedCache {
    func fetch<T: Codable>(key: String, on worker: Worker, fallback: @escaping () -> Future<T>) -> Future<T> {
        return get(key, as: T.self)
            .flatMap { cached in
                if let cached = cached {
                    return worker.future(cached)
                }

                return fallback()
                    .flatMap { self.set(key, to: $0).transform(to: $0) }
            }
    }
}

Usage

router.get("cached") { req -> Future<[Cat]> in
    let cache: KeyedCache = try req.make()

    return cache.fetch(key: "cats", on: req) {
        Cat.query(on: req).all() // <-- only executed once
    }
}
router.get("cachedOne") { req -> Future<Cat> in
    let cache: KeyedCache = try req.make()

    guard let name: String = req.query["name"] else {
        throw Abort(.badRequest)
    }

    return cache.fetch(key: "cat-\(name)", on: req) {
        Cat.query(on: req)
            .filter(\Cat.name == name)
            .first()
            .unwrap(or: Abort(.notFound))
    }
}

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.