

class PersistenceEngine(object):
    """ Basic persistence engine implemented as a regular Python dict."""

    def __init__(self):
        self._persistence = dict()

    def keys():
        return self._persistence.keys()

    def put(self, key, value):
        """ Put key value pair into storage"""
        self._persistence[key] = value

    def get(self, key):
        """ Get key's value """
        return self._persistence[key]

    def delete(self, key):
        """ Delete key value pair """
        del self._persistence[key]



class PersistenceEngine(object):
    """ Basic persistence engine implemented as a regular Python dict."""

    def __init__(self):
        self._persistence = dict()

    def keys():
        return self._persistence.keys()

    def put(self, key, value, timestamp):
        """ Put key value pair into storage"""
        self._persistence[key] = {'value': value, 'timestamp': timestamp}
        return True

    def get(self, key):
        """ Get key's value """
        return self._persistence[key]['value'], self._persistence[key]['timestamp']

    def delete(self, key):
        """ Delete key value pair """
        del self._persistence[key]
        return True

Remove use of timestamped value.
Remove use of timestamped value.

Thought it was dumb/inelegant to have a Value() object floating around
with value and timestamp .  Instead, now all messages are sent around
as json dicts.

The request enters the system as json, flows through to an endpoint
where it becomes a reply message, then flows back to the client.

  
  
  class PersistenceEngine(object):
      """ Basic persistence engine implemented as a regular Python dict."""
  
      def __init__(self):
          self._persistence = dict()
  
      def keys():
          return self._persistence.keys()
  
-     def put(self, key, value):
+     def put(self, key, value, timestamp):
          """ Put key value pair into storage"""
-         self._persistence[key] = value
+         self._persistence[key] = {'value': value, 'timestamp': timestamp}
+         return True
  
      def get(self, key):
          """ Get key's value """
-         return self._persistence[key]
+         return self._persistence[key]['value'], self._persistence[key]['timestamp']
  
      def delete(self, key):
          """ Delete key value pair """
          del self._persistence[key]
+         return True
  
Remove use of timestamped value.
## Code Before:


class PersistenceEngine(object):
    """ Basic persistence engine implemented as a regular Python dict."""

    def __init__(self):
        self._persistence = dict()

    def keys():
        return self._persistence.keys()

    def put(self, key, value):
        """ Put key value pair into storage"""
        self._persistence[key] = value

    def get(self, key):
        """ Get key's value """
        return self._persistence[key]

    def delete(self, key):
        """ Delete key value pair """
        del self._persistence[key]

## Instruction:
Remove use of timestamped value.
## Code After:


class PersistenceEngine(object):
    """ Basic persistence engine implemented as a regular Python dict."""

    def __init__(self):
        self._persistence = dict()

    def keys():
        return self._persistence.keys()

    def put(self, key, value, timestamp):
        """ Put key value pair into storage"""
        self._persistence[key] = {'value': value, 'timestamp': timestamp}
        return True

    def get(self, key):
        """ Get key's value """
        return self._persistence[key]['value'], self._persistence[key]['timestamp']

    def delete(self, key):
        """ Delete key value pair """
        del self._persistence[key]
        return True
