Compare commits
	
		
			1 Commits
		
	
	
		
			86bcec6b29
			...
			6ee1d6b300
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 6ee1d6b300 | 
@@ -8,9 +8,6 @@ class DummyClient:
 | 
				
			|||||||
    def set(self, key, value, **kwargs):
 | 
					    def set(self, key, value, **kwargs):
 | 
				
			||||||
        self._data[key] = value
 | 
					        self._data[key] = value
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def set_many(self, data, **kwargs):
 | 
					 | 
				
			||||||
        self._data.update(data)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def get(self, key, **kwargs):
 | 
					    def get(self, key, **kwargs):
 | 
				
			||||||
        return self._data[key]
 | 
					        return self._data[key]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -18,9 +15,4 @@ class DummyClient:
 | 
				
			|||||||
if constants.MEMCACHED_HOST_PATH is None:
 | 
					if constants.MEMCACHED_HOST_PATH is None:
 | 
				
			||||||
    client = DummyClient()
 | 
					    client = DummyClient()
 | 
				
			||||||
else:
 | 
					else:
 | 
				
			||||||
    client = Client(
 | 
					    client = Client(constants.MEMCACHED_HOST_PATH, timeout=1)
 | 
				
			||||||
        constants.MEMCACHED_HOST_PATH,
 | 
					 | 
				
			||||||
        timeout=1,
 | 
					 | 
				
			||||||
        allow_unicode_keys=True,
 | 
					 | 
				
			||||||
        encoding='utf-8'
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
from pydantic import BaseModel, Field
 | 
					from pydantic import BaseModel, Field
 | 
				
			||||||
from pymemcache.client.base import Client
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from .landmark import Landmark
 | 
				
			||||||
from .linked_landmarks import LinkedLandmarks
 | 
					from .linked_landmarks import LinkedLandmarks
 | 
				
			||||||
import uuid
 | 
					import uuid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -11,7 +11,7 @@ class Trip(BaseModel):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def from_linked_landmarks(self, landmarks: LinkedLandmarks, cache_client: Client) -> "Trip":
 | 
					    def from_linked_landmarks(self, landmarks: LinkedLandmarks, cache_client) -> "Trip":
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Initialize a new Trip object and ensure it is stored in the cache.
 | 
					        Initialize a new Trip object and ensure it is stored in the cache.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
@@ -22,9 +22,7 @@ class Trip(BaseModel):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        # Store the trip in the cache
 | 
					        # Store the trip in the cache
 | 
				
			||||||
        cache_client.set(f"trip_{trip.uuid}", trip)
 | 
					        cache_client.set(f"trip_{trip.uuid}", trip)
 | 
				
			||||||
        cache_client.set_many({f"landmark_{landmark.uuid}": landmark for landmark in landmarks}, expire=3600)
 | 
					        for landmark in landmarks:
 | 
				
			||||||
        # is equivalent to:
 | 
					            cache_client.set(f"landmark_{landmark.uuid}", landmark)
 | 
				
			||||||
        # for landmark in landmarks:
 | 
					 | 
				
			||||||
        #     cache_client.set(f"landmark_{landmark.uuid}", landmark, expire=3600)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return trip
 | 
					        return trip
 | 
				
			||||||
		Reference in New Issue
	
	Block a user