mirror of
https://github.com/gofiber/storage.git
synced 2025-12-24 13:29:30 +08:00
Fixed Nitpicks
This commit is contained in:
@@ -7,11 +7,12 @@ title: Aerospike
|
||||
[](https://gofiber.io/discord)
|
||||

|
||||
|
||||
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()
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user