cache

package
v0.0.0-...-519451a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: OSL-3.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cache provides Azure Cache for Redis Reserved Capacity client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureRetailPrice

type AzureRetailPrice = pricing.Page[pricing.RetailPriceItem]

AzureRetailPrice is the response envelope for the Azure Retail Prices API.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client handles Azure Cache for Redis Reserved Capacity.

func NewClient

func NewClient(cred azcore.TokenCredential, subscriptionID, region string) *Client

NewClient creates a new Azure Cache client.

func NewClientWithHTTP

func NewClientWithHTTP(cred azcore.TokenCredential, subscriptionID, region string, httpClient HTTPClient) *Client

NewClientWithHTTP creates a new Azure Cache client with a custom HTTP client (for testing). When httpClient is nil, the SSRF-hardened httpclient.New() is used so the nil fallback also blocks IMDS connections. A non-nil httpClient is used as-is and bypasses that guard: metadata, NAT64/6to4 and unspecified addresses are dialable unless the caller's client blocks them itself.

func (*Client) GetExistingCommitments

func (c *Client) GetExistingCommitments(ctx context.Context) ([]common.Commitment, error)

GetExistingCommitments retrieves existing Redis Cache reserved capacity.

func (*Client) GetOfferingDetails

func (c *Client) GetOfferingDetails(ctx context.Context, rec common.Recommendation) (*common.OfferingDetails, error)

GetOfferingDetails retrieves Redis Cache reservation offering details from Azure Retail Prices API.

func (*Client) GetRecommendations

func (c *Client) GetRecommendations(_ context.Context, _ *common.RecommendationParams) ([]common.Recommendation, error)

GetRecommendations returns an empty slice: Azure Redis recommendations are collected, labeled ServiceMemoryDB, by the managedredis client. Collecting them here too would list every Redis recommendation twice, and a ServiceCache label routes the purchase to a client that must not buy Redis.

func (*Client) GetRegion

func (c *Client) GetRegion() string

GetRegion returns the region.

func (*Client) GetServiceType

func (c *Client) GetServiceType() common.ServiceType

GetServiceType returns the service type.

func (*Client) PurchaseCommitment

PurchaseCommitment refuses: managedredis (ServiceMemoryDB) is the only Azure service that buys RedisCache reservations (#538), so one Redis recommendation cannot be bought twice.

func (*Client) SetReservationsPager

func (c *Client) SetReservationsPager(pager ReservationsDetailsPager)

SetReservationsPager sets the reservations pager (for testing).

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient interface for HTTP operations (enables mocking).

type RedisPricing

type RedisPricing struct {
	Currency         string
	HourlyRate       float64
	ReservationPrice float64
}

RedisPricing contains pricing information for Redis Cache.

type ReservationsDetailsPager

type ReservationsDetailsPager interface {
	More() bool
	NextPage(ctx context.Context) (armconsumption.ReservationsDetailsClientListResponse, error)
}

ReservationsDetailsPager interface for reservations details pager (enables mocking).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL