diff --git a/pyopencl/cache.py b/pyopencl/cache.py
index 51812eefea63732f324ac1ad6ddd1d8bfc4c3450..0a9572e0bcf154bcd69e6e41c12cc4fda3401b00 100644
--- a/pyopencl/cache.py
+++ b/pyopencl/cache.py
@@ -292,8 +292,9 @@ def _create_built_program_from_source_cached(ctx, src, options, devices, cache_d
     if cache_dir is None:
         from os.path import join
         from tempfile import gettempdir
+		import getpass
         cache_dir = join(gettempdir(),
-                "pyopencl-compiler-cache-v1-uid%s" % os.getuid())
+                "pyopencl-compiler-cache-v1-uid%s" % getpass.getuser()) 
 
     # {{{ ensure cache directory exists