Write a piece of code to implement a basic cache system. Implement basic_cache(capacity, operations), where each operation is ['get', key] or ['put', key, value]. Return the values produced by get operations, using -1 for missing keys; when full, evict the least recently used key. Both get and put on an existing key make it most recently used.
def basic_cache(capacity, operations):