Examples

    1. a. Let’s create the keyspace

      b. Let’s create the table:

      1. CREATE TABLE animals:cat keymap(str,binstr)

      c. Let’s switch to the table:

      1. USE animals:cat

      d. Let’s inspect it:

      1. INSPECT TABLE animals:cat

      e. Let’s drop the table:

      1. DROP TABLE animals:cat

      f. Let’s drop the keyspace

      1. DROP KEYSPACE animals
    2. Create a keymap table called ‘cache’ in the ‘default’ keyspace that is volatile. Our cache key is an str while the value would be some binary data, so binstr:

      1. CREATE TABLE cache keymap(str,binstr) volatile

    Lists

    1. Create a table called ‘notes’ in the default keyspace. We’ll have usernames linked to a collection of notes made by them. Since the names are unicode values, we’ll use the str type for the key. For the data type, we’ll use the list type, with the inner type as str since the notes will also have unicode characters (like emojis, for example). If we needed to store binary data within the lists, we’d simply use the binstr data type instead.

    2. Now let’s switch to the table

      1. use default:notes
    3. Let’s add some notes made by our theoretical user joe. This is how it goes (# signs were simply added for explanations, simply ignore them):

      1. LSET sayan
      2. # now append some notes
      3. LMOD sayan PUSH "Just woke up. Jotting down today's first note!"
      4. LMOD sayan PUSH "Heading to the subway; gotta get to work fast!"
      5. LMOD sayan PUSH "Funny that someone broke my chair! Just called someone to get it fixed!"
      6. LMOD sayan PUSH "Brrr...on my work machine. See you later!"
      7. LMOD sayan PUSH "Done with work, now heading home!"
      8. LMOD sayan PUSH "Woot, I'm home. What a hectic day!"
    4. Let’s read all the notes:

      1. LGET sayan

      This would have printed out all the notes if we were using the command-line client, like this:

      1. LGET sayan LIMIT 5

      This would output:

      1. (1) "Just woke up. Jotting down today's first note!"
      2. (3) "Funny that someone broke my chair! Just called someone to get it fixed!"
      3. (4) "Brrr...on my work machine. See you later!"
    5. Now let’s remove the “broken chair” note because it turns out that I actually had the wrong chair!

      1. LMOD sayan REMOVE 2

      Let’s see what we have with LGET sayan:

      1. (1) "Just woke up. Jotting down today's first note!"
      2. (2) "Heading to the subway; gotta get to work fast!"
      3. (3) "Brrr...on my work machine. See you later!"
      4. (4) "Done with work, now heading home!"
      5. (5) "Woot, I'm home. What a hectic day!"
    6. Wait, I forgot about something! Someone left a mysterious letter on my desk. I discovered it as soon as I entered my workplace. Let’s insert that:

      1. LMOD sayan INSERT 2 "Just discovered a mysterious letter on my desk! How cool!"
    7. Let’s get our entire bunch of notes now:

      1. (1) "Just woke up. Jotting down today's first note!"
      2. (2) "Heading to the subway; gotta get to work fast!"
      3. (3) "Just discovered a mysterious letter on my desk! How cool!"
      4. (4) "Brrr...on my work machine. See you later!"
      5. (6) "Woot, I'm home. What a hectic day!"