Fix the issue of seeing "Error while writing to artifact cache: an integer is required" during [cache check]

Apparently the order of args was swapped by mistake. Fixed the issue by using named param calling style and updated the arg validation which would fail tests if similar problem occurs.

Testing Done:
https://travis-ci.org/jinfeng/jinfeng-pants-fork/builds/39441973 has passed.

local tests:

PANTS_DEV=1 ./pants goal test ./tests/python/pants_test/cache/

Reviewed at https://rbcommons.com/s/twitter/r/1249/