Rewrite mem adapter to spec
Merge branch 'mem'