DisclaimerThis lecture and slides should be used only in humor, and thats how it should be understoodIf you find it offensive in any way, please do not use this slides, and go out from the lecture !
So what is Redis ?Open source in memory fast binary safe database that support the following: Key Value information Arrays/Lists and nested lists Sets/Sorted Sets Hashes Type of Message Queue Distributed work
Ah, yes, but what is Redis ? Hello my name is REmote Dictionary Server prepare to die
OK, its a Key Value database Are you happy now ?
How I met Redis ? I needed to use it with an Object Pascal basedProject, and there was no Object Pascal client … So I started to work on one: https://github.com/ik5/redis_client.fpc And I still do (when I have free time ...)
What is the first rule of Redis ?You do not talk about Redis …Rediss developer created most client libraries that exists today …The documentation that you see, well its can be better: What you read and what that is implemented are different things (sometimes) There are a lot of missing information,
So how do you write a client for Redis ?Reading the Protocol documentation (well, duh …)Finding that some of the real implementation is different then the protocol itselfWishing a slow death to the developerBitching about it at your blog (posts)Asking yourself: why dont you use a dynamic programming language ...Sitting down and solving the problems
Why ? Its very readable programming language Its string types (yes in plural) are easy to use Because it is one of the best compiled programminglanguages ever existedBecause I can !
Can you show us an example ?…var my_command : TRedisAbstractCommands;…writeln(my_command.ParamsToStr([a, 3.14, False]));…(* output as string : arn3.14rnFalsern *)
In soviet Russia several ways implement youFour ways to implement the client: Thinking like dynamic language (but code in Pascal) Thinking in C (but code in Pascal) Thinking in Java/C# (but code in Pascal) Think in Pascal …I read few implementation of the clients: Lua, Ruby, Perl, Python, Java and CDecided on the 4th way as the proper wayResearch and documentation by me on each command !“To infinity and beyond”
Data types TPersistent TRedisReturnType TRedisNullReturnType TRedisNumericReturnTypeTRedisStatusReturnType TRedisErrorReturnType TRedisMultiBulkReturnTypTRedisBulkReturnType e
There shell be a command ! TRedisObject TRedisParser TRedisAbstractCommandsCommand group Command group Command group Command group Command group Command group
Few more words regarding commands Every new version of Redis has new/changes to commands. Cant support such changes for long time So I my library helping you, by allowing you to call commands, never existed when I wrote the client, without going insane ! OK, You might go insane, but not because of my library...
Debug, Errors and log filesEach class can have its own log file for debug/error or no file at all !You can use also the same logger for every classYour own error handlers using callbacks, or just let exception raise up