Fixed Nitpicks

This commit is contained in:
MitulShah1
2025-04-14 17:29:41 +05:30
parent 3d26d32f1a
commit 69467ed7ab
2 changed files with 32 additions and 1 deletions

View File

@@ -7,11 +7,12 @@ title: Aerospike
[![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7)](https://gofiber.io/discord)
![Test](https://img.shields.io/github/actions/workflow/status/gofiber/storage/test-aerospike.yml?label=Tests)
A Aerospike client driver using `aerospike/aerospike-client-go` and [aerospike/aerospike-client-go](https://github.com/aerospike/aerospike-client-go).
An Aerospike client driver using `aerospike/aerospike-client-go` and [aerospike/aerospike-client-go](https://github.com/aerospike/aerospike-client-go).
**Note: Requires Go 1.23 and above**
### Table of Contents
- [Signatures](#signatures)
- [Installation](#installation)
- [Examples](#examples)
@@ -48,11 +49,13 @@ go get github.com/gofiber/storage/aerospike/v2
### Examples
Import the storage package.
```go
import "github.com/gofiber/storage/aerospike/v2"
```
You can use the following possibilities to create a storage:
```go
// Initialize default config
store := aerospike.New()

View File

@@ -138,6 +138,34 @@ func Test_AeroSpikeDB_Delete(t *testing.T) {
require.Nil(t, retrievedVal)
}
// Test_AeroSpikeDB_SetWithExpiration tests the Set method with expiration
func Test_AeroSpikeDB_SetWithExpiration(t *testing.T) {
var (
key = "temp"
val = []byte("value")
)
testStore := newTestStore(t)
defer testStore.Close()
// Set a value with 1 second expiration
err := testStore.Set(key, val, 1*time.Second)
require.NoError(t, err)
// Verify the value exists initially
retrievedVal, err := testStore.Get(key)
require.NoError(t, err)
require.Equal(t, val, retrievedVal)
// Wait for expiration
time.Sleep(2 * time.Second)
// Verify the value is gone
retrievedVal, err = testStore.Get(key)
require.NoError(t, err)
require.Nil(t, retrievedVal)
}
// Test_AeroSpikeDB_Reset tests the Reset method
func Test_AeroSpikeDB_Reset(t *testing.T) {