ported magic cache api to ruby