'Given a structure, will pickle, compress, and write to cache.'

def set(self, key, structure, course_context=None):

    if (self.cache is None):
        return None
    with TIMER.timer('CourseStructureCache.set', course_context) as tagger:
        pickled_data = pickle.dumps(structure, pickle.HIGHEST_PROTOCOL)
        tagger.measure('uncompressed_size', len(pickled_data))
        compressed_pickled_data = zlib.compress(pickled_data, 1)
        tagger.measure('compressed_size', len(compressed_pickled_data))
        self.cache.set(key, compressed_pickled_data, None)
