This is the start of big changes for er. er now directly implements all commands as of Redis 2.8.5 (some of the new commands aren't hooked up to erlang-specific type decoders yet. Fix as necessary). er now also generates multi-arity commands for Redis commands that support var args. Example: er now generates multi-functions like: er:mget/3, er:mget/4, er:mget/5, ..., er:mget/16. (16 by default, but you can increase it arbitrarily high *or* you can just add a list of the other arguments you want as well.) er maintains a list of Redis functions that aren't var arg capable (like GET versus MGET), so the fixed-arg functions don't get multi-arg counterparts. Also, er_server.lfe is gone because er_pool is the proper way of creating named and long-lived connections to your Redis server. Coming soon: erlang maps instead of proplists for some return values, moving to poolboy for the connection pool, support for sentinel, cluster, and live failover mechanisms.
The scripts read the command table directly from redis.c and can compare the redis command listing versus the commands er implements directly. (You can always run any command by passing a list to er_redis:q/2, but it helps to have proper commands with proper argumet decoders.)
The major change is LFE doesn't allow dot list deconstruction anymore, so (x . xs) now must be (cons x xs), and (#b("binary")) must now be (list #b("binary")). All tests pass as of this commit with LFE master 89ff3150d2.
This module hasn't been run or tested. It compiles with no errors or warnings. At worst, it crashes on start. More testing/fixes/viability is forthcoming.
Before, we would loop on a dead redis instance in the hopes it would quickly be restarted. Now we just die and let supervisors reload as necessary.
There are a series of in-progress redis<->lfe<->erlang helper macros in progress too. They'll turn into a nice system soon enough.
Turns out everything has a potential return type of <<"queued">> when using transactions. Ugly, but doable. We may want to make the return functions nested so we could have the <<"queued">> check in one place. The give-me-a-fun-and-i-do-you-a-txn style is inspired by mnesia. Just give er:er_transaction/2 or erp:er_transaction/1 a one-airity fun, use the parameter to the fun as your connection back to redis, and everything you need will Just Work.
Once you exec, you are no longer reserved. Same for discard. Shutdown now actually shuts down the er_pool. Reserved er_pools were evaporating if they crashed. Now if a reserved er_pool crashes, a new er_pool is spawned into the available pool again.
Example: (defkey-suite user (name addrs friends posts)). The above one line generates generates 12 functions (each function is duplicated. One has colons and its duplicate has underscores instead of colons to make calling from regular erlang easier): counter:user() user:N(N) user:N:name(N) user:N:addrs(N) user:N:friends(N) user:N:posts(N)
Now (defkey (user N stories)) makes two functions: user:N:stories(N) and user_N_stories(N). They both do the same thing (which is, return <<"user:N:stories">>). The underscore functions play nicer with regular erlang.
Also removing the include from defkey include to make it easier to include defkey in other applications directly from the deps/ directory.
i.e. (defkey key_comic_article (comic ComicNum article ArticleNum)) makes: key_comic_article(ComicNum, ArticleNum) -> eru:er_key(comic, ComicNum, article, ArticleNum). So calling key_comic_article(6, 12) generates <<"comic:6:article:12">>
er started out as a fork of another repository, but I quickly rewrote so much code of the broken original implementation, that the entire original repository ceased to have any code in this fork. But, github still showed the original parentage of this repository which made it look like er is "just a fork" instead of an entire project full of creativity, insight, and developmental awesomeness. So, under great pains, I'm truncating the history of er to this date. This will render all commit references to the prior repository useless, for which I am sorry. You are better off deleting your old repository and re-checking out this one. Please forward all complaints to management.