(self, entity: ModelEntity)
| 56 | return None |
| 57 | |
| 58 | async def set(self, entity: ModelEntity): |
| 59 | if not self.redis_conn: |
| 60 | return |
| 61 | |
| 62 | # Extract primary key fields and their values from entity |
| 63 | pk_fields = self.entity_class.primary_key_fields() |
| 64 | pk_values = {field: getattr(entity, field) for field in pk_fields} |
| 65 | |
| 66 | # Generate the Redis key using primary key values |
| 67 | key = self.__key(**pk_values, postfix=self.redis_key_postfix) |
| 68 | |
| 69 | # Convert entity to a dictionary suitable for Redis (assuming such a method exists) |
| 70 | entity_dict = entity.to_redis_dict() # This method depends on the actual implementation of ModelEntity |
| 71 | |
| 72 | # Set the object in Redis with the generated key and expiration |
| 73 | await self.redis_conn.set_object(key, entity_dict, self.expire) |
| 74 | |
| 75 | async def pop(self, entity: ModelEntity): |
| 76 | if not self.redis_conn: |
no test coverage detected