GithubHelp home page GithubHelp logo

fakeredis's People

Contributors

catwell avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fakeredis's Issues

support external sleep function

When needing to sleep, see if the "sleep" key is set on the client. If so, use it as the sleep function. Use the one from luasocket by default.

Add support for other APIs

It is nice to have redis-lua API built in, but there are other Redis client libraries with different semantics (for example, lua-resty-redis, my lua-hiredis etc.).

Wrapping redis-lua API in a proxy code to support other APIs would be weird and quirky. Please add a low-level API so anyone will be able to code their API on top of that.

DECR / INCR: handle integer overflow

In the Redis documentation we can see that those commands refuse to work with values that do not fit in 64 bits.

In Lua (at least until 5.3), we should actually limit it to what can be represented with integer precision in a number, i.e. any -2^53<n<2^53.

_z_update() needs a small adjustment

@catwell ,
Your fakeredis library is exactly what I was looking for.
A nice local Redis 100% in Lua able to run without remote Server.

I just would like to inform you that I am doing persistence on the self.data database table.
Therefore I noticed a small issue in zadd command, when the key was already stored at the database previously.
The solution is very simple, somehow you forgot to add the .s at _z_update() function.
Without the .s you are comparing 2 tables and this generates a Lua error.
With just this simple change it works perfectly well !!!

local _z_update = function(x, p)
local l = x.list
local found = _z_remove(x, p.v)
local ix = nil
for i=1,#l do
..if l[i].s > p.s then -- @@ Filgs: the .s was missing in the original library
....ix = i; break
..end
end
if not ix then ix = #l+1 end
_z_insert(x, ix, p)
return found
end

Very nice job !
@Filgs

Support linear args for HMSET

HMSET and maybe other commands only accept the table-based way of passing arguments, i.e. this works:

R:hmset("key", {foo = "bar", spam = "eggs"})

but not this:

R:hmset("key", "foo", "bar", "spam", "eggs")

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.