'How to achieve Solidity's mapping in Solana?

How to achieve the functionality of Solidity's mapping in Solana? What I need is a map with an arbitrary number of entries (it'll be evergrowing).

So how to calculate the rent exemption and how to actually do this? Is it even possible?

I just need 1 account, so 1 global hashmap in a program.

I would be storing keys as integers and values as strings.



Solution 1:[1]

in solana it's more common to use PDAs for this purpose, encode the key inside the seed and use the account data for storing the value.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Maximilian Schneider