public List<Integer> GetIds(String tempTable, String klassName)
	{
		tempTable = tempTable.replace("<", "_").replace(">","_");
		try
		{			
			File cacheDir = new File("cachedir");
			if( !cacheDir.exists())
			{
				cacheDir.mkdir();
			}
			File cache = new File("cachedir/_"+tempTable+"___"+klassName);
			CachedRowSet rowSet = new CachedRowSetImpl();  
			List<Integer> results = new ArrayList<Integer>();

			// using tags for 1-word names
			if( new WordDistributions().WordLength(klassName) ==1 )
			{
				ResultSet set = ResultCache.CachedQueryExecution("tag",
						"SELECT Id FROM "+ tempTable + " WHERE " + 
						"tags like '%<"+ klassName +"%>'",
						s);
				rowSet.populate(set);
			}
			else if( !cache.exists()) // else below
			{
				ResultSet set = s.executeQuery("SELECT Id FROM "+tempTable + " WHERE " + 
											   "BodyAndTitle like '%"+ klassName +"%'"
				);
				rowSet.populate(set);
				// http://java.sun.com/developer/technicalArticles/Programming/serialization/
				// serialize
				FileOutputStream fos = new FileOutputStream(cache.getAbsolutePath());
				ObjectOutputStream out = new ObjectOutputStream(fos);
				out.writeObject(rowSet);
				out.close();
			}
			else
			{
				// deserialize
				FileInputStream fos = new FileInputStream(cache.getAbsolutePath());
				ObjectInputStream in = new ObjectInputStream(fos);
				rowSet = (CachedRowSet)in.readObject();
				in.close();
			}
			while( rowSet.next() )
			{
				results.add( rowSet.getInt("Id"));
			}
			return results;
		}
		catch (SQLException e) 
		{
			e.printStackTrace();
		}
		catch(IOException ex)
		{
			ex.printStackTrace();
		} 
		catch (ClassNotFoundException e) 
		{
			e.printStackTrace();
		}

		return null;
	}