Author: norman.richards(a)jboss.com
Date: 2008-11-05 12:59:39 -0500 (Wed, 05 Nov 2008)
New Revision: 9509
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Cache.xml
Log:
JBSEAM-3627
Modified: trunk/doc/Seam_Reference_Guide/en-US/Cache.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Cache.xml 2008-11-05 14:32:19 UTC (rev 9508)
+++ trunk/doc/Seam_Reference_Guide/en-US/Cache.xml 2008-11-05 17:59:39 UTC (rev 9509)
@@ -300,18 +300,21 @@
<para>Now you can inject the cache into any Seam component:</para>
- <programlisting
role="JAVA"><![CDATA[@Name("chatroom")
-public class Chatroom {
- @In CacheProvider cacheProvider;
-
- public void join(String username) {
- Set<String> userList = (Set<String>)
pojoCache.get("chatroom", "userList");
- if (userList==null) {
- userList = new HashSet<String>();
- cacheProvider.put("chatroom", "userList", userList);
- }
- userList.put(username);
- }
+ <programlisting
role="JAVA"><![CDATA[@Name("chatroomUsers")
+(a)Scope(ScopeType.STATELESS)
+public class ChatroomUsers
+{
+ @In CacheProvider cacheProvider;
+
+ @Unwrap
+ public Set<String> getUsers() throws CacheException {
+ Set<String> userList = (Set<String>)
cacheProvider.get("chatroom", "userList");
+ if (userList==null) {
+ userList = new HashSet<String>();
+ cacheProvider.put("chatroom", "userList", userList);
+ }
+ return userList;
+ }
}]]></programlisting>
<para>
Show replies by date