When you clear codes they will be reset and remain cleared unless the vehicle detects that the issue is still present.
It could take anywhere from milliseconds (electrical issues, shorted wiring) to days (emissions issues) for the vehicle to detect a recurrent issue - but if the root cause has not been resolved the code will return eventually.
Unfortunately it is not possible to permanently clear a code and prevent it from returning unless the proper repairs are performed.