Python Object Storage in Azure Redis Cache

Sai 0 Reputation points
2025-04-24T21:31:51.4266667+00:00

I have python application which is used for load testing of API (works with locust in backend) ..i would like to store all locust environment , runner and stats data which are python objects(Class) and non serializable which cannot be stored in redis in straightforward way...can you please suggest what could be the approach ? You can see what I mean by environment,runner in https://docs.locust.io/en/stable/use-as-lib.html

Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
305 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 22,031 Reputation points Volunteer Moderator
    2025-04-25T02:14:38.69+00:00

    Hello Sai,

    Storing non-serializable Python objects in Redis can be challenging, but there are a few approaches you can consider such as:

    • Serialization with Pickle.
    • Using JSON for Serializable Parts.
    • Use redis-protobuf to serialize and store data.
    • or would you like to implement custom serialization methods for your classes.

    Let me know your preferences or the previous you've already using, and I will revert shortly.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.