Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestLRU_Add_ExistingKey_UpdatesValueAndExpiresAt (0.65 sec)

  1. tests/lru_test.go

    package tests_test
    
    import (
    	"crypto/rand"
    	"fmt"
    	"gorm.io/gorm/internal/lru"
    	"math"
    	"math/big"
    	"reflect"
    	"sync"
    	"testing"
    	"time"
    )
    
    func TestLRU_Add_ExistingKey_UpdatesValueAndExpiresAt(t *testing.T) {
    	lru := lru.NewLRU[string, int](10, nil, time.Hour)
    	lru.Add("key1", 1)
    	lru.Add("key1", 2)
    
    	if value, ok := lru.Get("key1"); !ok || value != 2 {
    		t.Errorf("Expected value to be updated to 2, got %v", value)
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Sun May 25 07:40:40 UTC 2025
    - 10.4K bytes
    - Viewed (0)
Back to top