示例#1
0
  public static Vote getVote(int uid, int sid) {
    ObjectCache cache = ObjectCache.getInstance();
    Vote v = (Vote) cache.lookupObject(uid, sid, "votes");
    if (v == null) {
      v = new Vote(uid, sid);
    }

    return v;
  }
示例#2
0
  public Vote(int uid, int sid) {
    this.uid = uid;
    this.sid = sid;

    String query = "SELECT upvote FROM votes WHERE uid = ? AND sid = ?";
    ArrayList<Object> args = new ArrayList<Object>();
    args.add(new Integer(uid));
    args.add(new Integer(sid));
    vote = DataAccess.queryReturnInt(get_vote, query, args, "upvote");

    ObjectCache cache = ObjectCache.getInstance();
    cache.addObject(this, uid, sid, "votes");
  }