Skip to content

Commit

Permalink
Update objects.md (#49)
Browse files Browse the repository at this point in the history
Fixed some spelling and sentences.

Co-authored-by: Tal Zaccai <[email protected]>
  • Loading branch information
JohannesEH and TalZaccai authored Mar 19, 2024
1 parent 627425e commit 5b0baaf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions website/docs/extensions/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ title: Objects

# Server-Side Object Extensions

Garnet offers different ways to extent its functionality, one of them by adding your own implementation of a Custom Object; similar to what a Set, List or a Sorted Set offers but using your own type of object and custome commmands functionality with the C# language.
Garnet offers different ways to extend its functionality, one of them by adding your own implementation of a Custom Object; similar to what a Set, List or a Sorted Set offers but using your own type of object and custom commmands functionality with the C# language.

In this document we'll explain the implemenation of a new object type, based on the Dictionary type of C#, then we'll add some custom commands that will use this new object type.
In this document we'll explain the implementation of a new object type, based on the Dictionary type of C#, then we'll add some custom commands that will use this new object type.


**Implementing a Custom Object**

In order to add a new object type, you first need to implement a new class that inherits from GarnetObjectBase class. This class contains escential methods to manage the basic functionality of a key in Garnet.
In order to add a new object type, you first need to implement a new class that inherits from GarnetObjectBase class. This class contains essential methods to manage the basic functionality of a key in Garnet.

**Adding a Factory class**

Once the new Custom Object class implementation has been added, it is required also a class that will manage the creation of this new Object type, this class is CustomObjectFactory.
Once the new Custom Object class implementation has been added, it also requires a class that will manage the creation of the new Object type, this class is CustomObjectFactory.

**The Operate methods**

Every command in Garnet has a unique identifier in order to map the different operators to its corresponding type to which they can be applied. Take as an example the ZADD command, this command is only used on a Sorted Set type. In addition to its core functionality of the ZADD, it contains optional functionality based on each of the flags or switches that the user can pass as part of the command expression.
Every command in Garnet has a unique identifier in order to map the different operators to its corresponding type to which they can be applied. Take as an example the ZADD command, this command is only used on a Sorted Set type. In addition to its core functionality of the ZADD, it contains optional functionality based on each of the flags or switches that the user can pass as part of the command expression.

These both elements of a command expresion are called Command and Subcommand respectively.
Each of them are applied in the following methods of the GarnetObjectBase class and you will need to add your custom functionality at these specific methods.
Expand All @@ -40,4 +40,4 @@ public override sealed unsafe bool Operate(ref SpanByte input, ref SpanByteAndMe


:::tip
As a reference of an implementation of a Custom Object type, see the example in GarnetServer\MyDictObject.cs.
As a reference of an implementation of a Custom Object type, see the example in GarnetServer\MyDictObject.cs.

0 comments on commit 5b0baaf

Please sign in to comment.