I have enabled cached posts lifespan to 30days .
I have added this additional code to bbcode in Style manager to hide content in code tags.

Code:
[COLOR=#b22222]<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">[/COLOR]

<div class="bbcode_container">
    <div class="bbcode_description">{vb:rawphrase code}:</div>
    <pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>>{vb:raw code}</pre>
</div>

[COLOR=#b22222]<vb:else />
<a href="http://mysite.net/register.php" target="_blank"> Register to view </a>
</vb:if>[/COLOR]
I don't think code tags are hidden from unregistered users or Google index .I think the cached posts look the same to all usergroups (registered or unregistered) since it is made with admin rights and copied to server hard-disc like a photo.Am i right or is there anything i can do ?

Some posts with code tags are hidden even from registered usergroup 1,2,3 for some reason .Now when i rebuild the cache its showing to registered users.Why did it cache the post with hidden code ?