Skip to content

Commit 1f2cc91

Browse files
Adam BaloghAdam Balogh
authored andcommitted
cache
1 parent 9875504 commit 1f2cc91

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tokens/portfolio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import List, Optional
22
import os
3+
import cachetools.func
34

45
from solana.rpc.api import Client
56
from solana.rpc.types import TokenAccountOpts, Pubkey
@@ -19,6 +20,7 @@ def __init__(self, token_metadata_repo: TokenMetadataRepo):
1920
self.token_metadata_repo = token_metadata_repo
2021
self.http_client = Client(self.RPC_URL)
2122

23+
@cachetools.func.ttl_cache(maxsize=1000, ttl=300)
2224
def get_portfolio(self, wallet_address: str) -> Portfolio:
2325
"""Get the complete portfolio of token holdings for a wallet address."""
2426
token_accounts = self.get_token_accounts(wallet_address)

0 commit comments

Comments
 (0)