Skip to content

Commit

Permalink
Merge branch 'master' into sadd-command-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorvyadav1111 authored Nov 5, 2024
2 parents 9187b7c + 0048dc6 commit 636a78e
Show file tree
Hide file tree
Showing 289 changed files with 8,314 additions and 4,201 deletions.
6 changes: 3 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
DiceDB welcomes your contributions! Whether you're fixing bugs, adding new features, or improving the documentation, your help is valuable.
DiceDB welcomes your contributions! Whether you're fixing bugs, adding new features, or improving the documentation, your help is valuable.

To maintain the project's quality and consistency, please follow these guidelines:

- Keep the code consistent: Use the same coding style and conventions throughout the project.
- Keep the git repository consistent: Follow proper git practices to avoid conflicts and ensure a clean history.
- Keep the code consistent: Use the same coding style and conventions throughout the project.
- Keep the git repository consistent: Follow proper git practices to avoid conflicts and ensure a clean history.

# Contribution Guidelines

Expand Down
2 changes: 1 addition & 1 deletion docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default defineConfig({
// },
{
label: "SDK",
autogenerate: { directory: "sdk" },
autogenerate: { directory: "sdk" },
},
{
label: "Connection Protocols",
Expand Down
41 changes: 28 additions & 13 deletions docs/command_docs_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: <CMD NAME HERE>
description: description here in 2 to 3 lines
---

<!-- description in 2 to 3 sentences, following is an example -->
<!-- for sample template please check sample_command_docs.md file -->

Expand All @@ -15,58 +16,67 @@ description: description here in 2 to 3 lines
<!-- please mention them in subcommands section and create their individual documents -->

## Parameters
<!-- please add all parameters, small description, type and required, see example for SET command-->
| Parameter | Description | Type | Required |
|-----------|---------------------------------------------------------------------------|---------|----------|
| | | | |
| | | | |
| | | | |

<!-- please add all parameters, small description, type and required, see example for SET command-->

| Parameter | Description | Type | Required |
| --------- | ----------- | ---- | -------- |
| | | | |
| | | | |
| | | | |

## Return values

<!-- add all scenarios, see below example for SET -->

| Condition | Return Value |
|------------------------------------------------|---------------------------------------------------|
| | |
| | |
| | |
| Condition | Return Value |
| --------- | ------------ |
| | |
| | |
| | |

## Behaviour

<!-- How does the command execute goes here, kind of explaining the underlying algorithm -->
<!-- see below example for SET command -->
<!-- Please modify for the command by going through the code -->

- Bullet 1
- Bullet 2
- Bullet 3

## Errors

<!-- sample errors, please update for commands-->
<!-- please add all the errors here -->
<!-- incase of a dynamic error message, feel free to use variable names -->
<!-- follow below bullet structure -->

1. `Wrong type of value or key`:

- Error Message: `(error) WRONGTYPE Operation against a key holding the wrong kind of value`
- Occurs when attempting to use the command on a key that contains a non-string value.


## Example Usage

<!-- please add examples for the command -->
<!-- Its good to have example using flags and arguments -->
<!-- Also adding for errors provide idea about the command -->

<!-- example heading in h3 -->

### Basic Usage

<!-- Always use bash code style block -->

```bash
127.0.0.1:7379> SET foo bar
OK
```

<!-- Please use detailed scenarios and edges cases if possible -->
<!-- example heading in h3 -->

### Invalid usage

```bash
Expand All @@ -81,20 +91,25 @@ OK
<!-- anything related to the command which cannot be shared in other sections -->

<!-- Optional -->

## Best Practices

<!-- Optional -->

## Alternatives

<!-- Optional -->
## Notes

## Notes

<!-- Optional -->

## Subcommands

<!-- if the command you are working on has subcommands -->
<!-- please mention them here and add links to the pages -->
<!-- please see below example for COMMAND docs -->
<!-- follow below bullet structure -->

- **subcommand**: Optional. Available subcommands include:
- `subcommand1` : some description of the subcommand.
38 changes: 31 additions & 7 deletions docs/sample_command_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@
title: SET
description: The `SET` command in DiceDB is used to set the value of a key. If the key already holds a value, it is overwritten, regardless of its type. This is one of the most fundamental operations in DiceDB as it allows for both creating and updating key-value pairs.
---

<!-- description in 2 to 3 sentences, following is an example -->

The `SET` command in DiceDB is used to set the value of a key. If the key already holds a value, it is overwritten, regardless of its type. This is one of the most fundamental operations in DiceDB as it allows for both creating and updating key-value pairs.

## Syntax

```bash
SET key value [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | KEEPTTL] [NX | XX]
```

<!-- If the command have subcommands please mention but do not consider them as arguments -->
<!-- please mention them in subcommands section and create their individual documents -->

## Parameters

<!-- please add all parameters, small description, type and required, see example for SET command-->

| Parameter | Description | Type | Required |
|-----------|---------------------------------------------------------------------------|---------|----------|
| --------- | ------------------------------------------------------------------------- | ------- | -------- |
| `key` | The name of the key to be set. | String | Yes |
| `value` | The value to be set for the key. | String | Yes |
| `EX` | Set the specified expire time, in seconds. | Integer | No |
Expand All @@ -28,27 +33,30 @@ SET key value [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix
| `KEEPTTL` | Retain the time-to-live associated with the key. | None | No |

## Return values

<!-- add all scenarios, see below example for SET -->

| Condition | Return Value |
|------------------------------------------------|---------------------------------------------------|
| if key is set successfully | `OK` |
| If `NX` is used and key already exists | `nil` |
| If `XX` is used and key doesn't exist | `nil` |
| Condition | Return Value |
| -------------------------------------- | ------------ |
| if key is set successfully | `OK` |
| If `NX` is used and key already exists | `nil` |
| If `XX` is used and key doesn't exist | `nil` |

## Behaviour

<!-- How does the command execute goes here, kind of explaining the underlying algorithm -->
<!-- see below example for SET command -->
<!-- Please modify for the command by going through the code -->

- If the specified key already exists, the `SET` command will overwrite the existing key-value pair with the new value unless the `NX` option is provided.
- If the `NX` option is present, the command will set the key only if it does not already exist. If the key exists, no operation is performed and `nil` is returned.
- If the `XX` option is present, the command will set the key only if it already exists. If the key does not exist, no operation is performed and `nil` is returned.
- Using the `EX`, `EXAT`, `PX` or `PXAT` options together with `KEEPTTL` is not allowed and will result in an error.
- When provided, `EX` sets the expiry time in seconds and `PX` sets the expiry time in milliseconds.
- The `KEEPTTL` option ensures that the key's existing TTL is retained.


## Errors

<!-- sample errors, please update for commands-->
<!-- please add all the errors here -->
<!-- incase of a dynamic error message, feel free to use variable names -->
Expand All @@ -71,6 +79,7 @@ SET key value [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix
## Example Usage

### Basic Usage

<!-- examples here are for set, please update them for the command -->

Setting a key `foo` with the value `bar`
Expand All @@ -79,7 +88,9 @@ Setting a key `foo` with the value `bar`
127.0.0.1:7379> SET foo bar
OK
```

<!-- Please use detailed scenarios and edges cases if possible -->

### Using expiration time (in seconds)

Setting a key `foo` with the value `bar` to expire in 10 seconds
Expand Down Expand Up @@ -141,36 +152,49 @@ Trying to set key `foo` with both `EX` and `KEEPTTL` will result in an error
127.0.0.1:7379> SET foo bar EX 10 KEEPTTL
(error) ERR syntax error
```

<!-- Optional: Used when additional information is to conveyed to users -->
<!-- For example warnings about usage ex: Keys * -->
<!-- OR alternatives of the commands -->
<!-- Or perhaps deprecation warning -->
<!-- anything related to the command which cannot be shared in other sections -->

<!-- Optional -->

## Best Practices

<!-- below example from Keys command -->

- `Avoid in Production`: Due to its potential to slow down the server, avoid using the `KEYS` command in a production environment. Instead, consider using the `SCAN` command, which is more efficient for large keyspaces.
- `Use Specific Patterns`: When using the `KEYS` command, try to use the most specific pattern possible to minimize the number of keys returned and reduce the load on the server.

<!-- Optional -->

## Alternatives

<!-- below example from keys command -->

- `SCAN`: The `SCAN` command is a cursor-based iterator that allows you to incrementally iterate over the keyspace without blocking the server. It is a more efficient alternative to `KEYS` for large datasets.

<!-- Optional -->

## Notes

<!-- below example from json.get command -->

- JSONPath expressions allow you to navigate and retrieve specific parts of a JSON document. Ensure that your JSONPath expressions are correctly formatted to avoid errors.

By understanding the `JSON.GET` command, you can efficiently retrieve JSON data stored in your DiceDB database, enabling you to build powerful and flexible applications that leverage the capabilities of DiceDB.

<!-- Optional -->

## Subcommands

<!-- if the command you are working on has subcommands -->
<!-- please mention them here and add links to the pages -->
<!-- please see below example for COMMAND docs -->
<!-- follow below bullet structure -->

- **subcommand**: Optional. Available subcommands include:
- `COUNT` : Returns the total number of commands in the DiceDB server.
- `GETKEYS` : Returns the keys from the provided command and arguments.
Expand Down
14 changes: 3 additions & 11 deletions docs/src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ import { Github } from "lucide-astro";
<a href="/commands/get" style="color: #333;"> Commands</a>
</p>
<p>
<a
href="/get-started/realtime-leaderboard/"
style="color: #333;"
>
<a href="/get-started/realtime-leaderboard/" style="color: #333;">
Examples</a
>
</p>
Expand All @@ -69,10 +66,7 @@ import { Github } from "lucide-astro";
Examples
</div>
<p>
<a
href="/get-started/realtime-leaderboard/"
style="color: #333;"
>
<a href="/get-started/realtime-leaderboard/" style="color: #333;">
Real-time Leaderboard</a
>
</p>
Expand All @@ -88,9 +82,7 @@ import { Github } from "lucide-astro";
<a href="/about-us" style="color: #333;"> About Us</a>
</p> -->
<p>
<a href="mailto:[email protected]" style="color: #333;">
Contact Us</a
>
<a href="mailto:[email protected]" style="color: #333;"> Contact Us</a>
</p>
<br />
<p>
Expand Down
47 changes: 18 additions & 29 deletions docs/src/components/Hero.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,25 @@ import Dice from "./Dice.astro";
import site from "../data/site.json";
---

<div id="hero" class="hero">
<div class="hero-body">
<div class="columns is-vcentered">
<div class="column is-7 has-text-left">
<a class="button" href="/blog/dicedb-004-release-notes">
<span>We shipped DiceDB v0.0.4</span>
<span class="icon"><MoveRight /></span>
</a>
<div class="image is-128x128">
<img src="/icon.png" alt="DiceDB Logo" />
</div>
<br />
<h1 class="title is-size-1">Build truly real-time applications</h1>
<p class="subtitle is-size-5">
DiceDB is an in-memory, real-time, and reactive database with Redis and SQL support optimized for modern hardware and building real-time applications.
<div>
<div>
<div class="columns is-vcentered is-centered">
<div class="column content section is-8 has-text-centered">
<h1 class="title is-size-1">a super cache;</h1>
<p class="is-size-5">
DiceDB is a redis-compliant, scalable, highly available, unified cache
optimized for modern hardware
<span class="has-text-danger">*</span>
</p>
<div class="buttons is-large">
<a
href="/get-started/installation/"
class="button is-primary is-medium"
>
<p class="notification has-text-weight-bold">
docker run -p 7379:7379 dicedb/dicedb
</p>
<div class="buttons is-centered">
<a href="/get-started/installation/" class="button is-primary">
<strong>Get Started →</strong>
</a>
<a
class="button is-medium"
class="button"
target="_blank"
href="https://github.com/dicedb/dice"
title="DiceDB source code on GitHub"
Expand All @@ -37,16 +31,11 @@ import site from "../data/site.json";
<span>GitHub (6k+)</span>
</a>
</div>
<p class="has-text-grey">
Want to evaluate and adopt DiceDB at your org?
<a href={site.calendar_url} target="_blank">block our calendar</a>.
<p class="is-small has-text-grey">
<span class="has-text-danger">*</span> DiceDB is a work in progress; track
<a href="/roadmap">roadmap</a> and follow along.
</p>
</div>
<div class="column is-1"></div>
<div class="column is-4 is-hidden-mobile">
<br />
<Dice />
</div>
</div>
</div>
</div>
6 changes: 3 additions & 3 deletions docs/src/components/Nav.astro
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ import SocialHandlesIcons from "./SocialHandlesIcons.astro";
class={`navbar-item ${currentPage === "benchmarks" && "is-active"}`}
href="/benchmarks"
>
<span class="has-text-weight-bold is-size-5"> Benchmarks</span>
<span class="has-text-weight-bold"> Benchmarks</span>
</a>
<a
class={`navbar-item ${currentPage === "docs" && "is-active"}`}
href="/get-started/installation/"
>
<span class="has-text-weight-bold is-size-5"> Docs</span>
<span class="has-text-weight-bold"> Docs</span>
</a>
<a
class={`navbar-item ${currentPage === "blogs" && "is-active"}`}
href="/blog"
>
<span class="has-text-weight-bold is-size-5"> Blog</span>
<span class="has-text-weight-bold"> Blog</span>
</a>
<div class="navbar-item">
<SocialHandlesIcons />
Expand Down
Loading

0 comments on commit 636a78e

Please sign in to comment.