Nope, adding cache code will not compromise or affect your security in any way. This caching code is similar to our Speed Boost cache code in the link below.
http://forum.ait-pro.com/forums/topic/htaccess-caching-code-speed-boost-cache-code/
You can either use this cache code or the Speed Boost cache code and follow the instructions in the link above to add this code to BPS Custom Code.