This is a grey area, and the popular claim that clearing your cache makes it undetectable is simply wrong — server-side logs exist precisely so operators can see where connections came from.
Running or playing on a private server almost always breaches the game's terms of service and copyright licence, even where no money changes hands. Consequences in practice are account termination and, in some cases, hardware or IP bans.
If you want the game without the risk, look for an official free-to-play version or a community server the publisher actually sanctions.