By moving the cache to a separate HashMap or something, neurons would not need to be stored in a RwLock, greatly reducing the amount of data being cloned while transferring between topology and mutable. Additionally, flush_state could be merged into predict without fear of performance issues because the map can simply be replaced by a new one in memory, which is way faster than the current iterative approach.