github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/vector/cache/cache.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package cache
    13  
    14  import (
    15  	"context"
    16  	"time"
    17  )
    18  
    19  const DefaultDeletionInterval = 3 * time.Second
    20  
    21  type Cache[T any] interface {
    22  	Get(ctx context.Context, id uint64) ([]T, error)
    23  	MultiGet(ctx context.Context, ids []uint64) ([][]T, []error)
    24  	Len() int32
    25  	CountVectors() int64
    26  	Delete(ctx context.Context, id uint64)
    27  	Preload(id uint64, vec []T)
    28  	Prefetch(id uint64)
    29  	Grow(size uint64)
    30  	Drop()
    31  	UpdateMaxSize(size int64)
    32  	CopyMaxSize() int64
    33  	All() [][]T
    34  }