Create a Durable Object that stores the last location it was accessed from in-memory.
This example shows you how Durable Objects are stateful, meaning in-memory state can be retained between requests. After a brief period of inactivity, the Durable Object will be evicted, and all in-memory state will be lost. The next request will reconstruct the object, but instead of showing the city of the previous request, it will display a message indicating that the object has been reinitialized. If you need your applications state to survive eviction, write the state to storage by using the Storage API, or by storing your data elsewhere.
Finally, configure your wrangler.toml file to include a Durable Object binding and migration based on the namespace and class name chosen previously.