This code is not database / SQL aware and thus I'd say this is the wrong place to do the conversion. In fact there is already some code in put() that does this. See https://github.com/owncloud/core/blob/master/lib/files/cache/cache.php#L204