I have a requirement to disable the caching in squid except for the DNS. I have done a configuration change in squid.conf like "cache deny all" does this help me out? I think it also disables DNS cahching right? so can any one help me to solve this issue.
What you want to do isn't possible. Squid is an http cache, not a caching name server. It will listen for http requests and reply to them with cached content. It does not listen for DNS requests and can not reply to them. It's true that squid caches DNS requests, but this is for its internal use. Web browsers do the same thing; it doesn't mean you can use Firefox as a DNS cache.
Like Hyppy said, you can configure a name server, such as bind or dnsmasq, to do what you want.